Added test cases for checking is archive created with invalid zim file , added remove book from library by id tests

This commit is contained in:
MohitMaliFtechiz 2023-03-22 17:18:41 +05:30 committed by Matthieu Gautier
parent bea92d800d
commit d6e4479621

View File

@ -71,6 +71,15 @@ public class test {
assertEquals(new String(faviconData), c);
archive.dispose();
// test reader with invalid zim file
String zimFile = "test.zim";
try {
Archive archive1 = new Archive(zimFile);
fail("ERROR: Archive created with invalid Zim file!");
} catch (ZimFileFormatException zimFileFormatException) {
assertEquals("Cannot open zimfile " + zimFile, zimFileFormatException.getMessage());
}
}
@Test
@ -145,6 +154,11 @@ public class test {
String[] bookIds = lib.getBooksIds();
assertEquals(bookIds.length, 1);
lib.filter(new Filter().local(true));
// remove book from library by id
lib.removeBookById(bookIds[0]);
bookIds = lib.getBooksIds();
assertEquals(bookIds.length, 0);
}
@Test