Modified tests to accommodate JUnit5 and Mockito API changes
This commit is contained in:
parent
251d19f456
commit
c633f1fcc2
@ -7,6 +7,7 @@ import org.junit.jupiter.api.AfterEach;
|
|||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.mockito.ArgumentMatchers;
|
||||||
import org.telegram.abilitybots.api.db.DBContext;
|
import org.telegram.abilitybots.api.db.DBContext;
|
||||||
import org.telegram.abilitybots.api.objects.*;
|
import org.telegram.abilitybots.api.objects.*;
|
||||||
import org.telegram.abilitybots.api.sender.MessageSender;
|
import org.telegram.abilitybots.api.sender.MessageSender;
|
||||||
@ -143,7 +144,9 @@ public class AbilityBotTest {
|
|||||||
Object backup = getDbBackup();
|
Object backup = getDbBackup();
|
||||||
java.io.File backupFile = createBackupFile(backup);
|
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);
|
bot.recoverDB().replies().get(0).actOn(update);
|
||||||
|
|
||||||
verify(silent, times(1)).send(RECOVER_SUCCESS, GROUP_ID);
|
verify(silent, times(1)).send(RECOVER_SUCCESS, GROUP_ID);
|
||||||
|
@ -90,7 +90,7 @@ class MapDBContextTest {
|
|||||||
// Name - Type - Number of "rows"
|
// Name - Type - Number of "rows"
|
||||||
String expectedSummary = format("%s - Set - 1\n%s - Set - 1", TEST, anotherTest);
|
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
|
@Test
|
||||||
@ -101,7 +101,7 @@ class MapDBContextTest {
|
|||||||
// JSON
|
// JSON
|
||||||
String expectedInfo = "TEST - Set - 1";
|
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
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user