Modified tests to accommodate JUnit5 and Mockito API changes

This commit is contained in:
Abbas Abou Daya 2019-07-08 23:18:08 -07:00
parent 251d19f456
commit c633f1fcc2
2 changed files with 6 additions and 3 deletions

View File

@ -7,6 +7,7 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentMatchers;
import org.telegram.abilitybots.api.db.DBContext;
import org.telegram.abilitybots.api.objects.*;
import org.telegram.abilitybots.api.sender.MessageSender;
@ -143,7 +144,9 @@ public class AbilityBotTest {
Object backup = getDbBackup();
java.io.File backupFile = createBackupFile(backup);
when(sender.downloadFile(any(File.class))).thenReturn(backupFile);
// Support for null parameter matching since due to mocking API changes
when(sender.downloadFile(ArgumentMatchers.<File>isNull())).thenReturn(backupFile);
bot.recoverDB().replies().get(0).actOn(update);
verify(silent, times(1)).send(RECOVER_SUCCESS, GROUP_ID);

View File

@ -90,7 +90,7 @@ class MapDBContextTest {
// Name - Type - Number of "rows"
String expectedSummary = format("%s - Set - 1\n%s - Set - 1", TEST, anotherTest);
assertEquals("Actual DB summary does not match that of the expected", expectedSummary, actualSummary);
assertEquals(expectedSummary, actualSummary, "Actual DB summary does not match that of the expected");
}
@Test
@ -101,7 +101,7 @@ class MapDBContextTest {
// JSON
String expectedInfo = "TEST - Set - 1";
assertEquals("Actual DB structure info does not match that of the expected", expectedInfo, actualInfo);
assertEquals(expectedInfo, actualInfo, "Actual DB structure info does not match that of the expected");
}
@Test