Skip to content

Commit 23b7987

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 3a25297 commit 23b7987

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
@@ -71,6 +71,15 @@ public void testArchive()
7171
assertEquals(new String(faviconData), c);
7272

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

7685
@Test
@@ -145,6 +154,11 @@ public void testLibrary()
145154
String[] bookIds = lib.getBooksIds();
146155
assertEquals(bookIds.length, 1);
147156
lib.filter(new Filter().local(true));
157+
158+
// remove book from library by id
159+
lib.removeBookById(bookIds[0]);
160+
bookIds = lib.getBooksIds();
161+
assertEquals(bookIds.length, 0);
148162
}
149163

150164
@Test

0 commit comments

Comments
 (0)