Skip to content

Commit 531e46b

Browse files
author
MohitMaliFtechiz
committed
Added test cases for checking is archive created with invalid zim file , added remove book from library by id tests
1 parent 160428d commit 531e46b

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lib/src/test/test.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ public void testArchive()
7070
assertEquals(new String(faviconData), c);
7171

7272
archive.dispose();
73+
74+
// test reader with invalid zim file
75+
String zimFile = "test.zim";
76+
try {
77+
Archive archive1 = new Archive(zimFile);
78+
fail("ERROR: Archive created with invalid Zim file!");
79+
} catch (ZimFileFormatException zimFileFormatException) {
80+
assertEquals("Cannot open zimfile " + zimFile, zimFileFormatException.getMessage());
81+
}
7382
}
7483

7584
@Test
@@ -144,6 +153,11 @@ public void testLibrary()
144153
String[] bookIds = lib.getBooksIds();
145154
assertEquals(bookIds.length, 1);
146155
lib.filter(new Filter().local(true));
156+
157+
// remove book from library by id
158+
lib.removeBookById(bookIds[0]);
159+
bookIds = lib.getBooksIds();
160+
assertEquals(bookIds.length, 0);
147161
}
148162

149163
@Test

0 commit comments

Comments
 (0)