diff --git a/lib/src/test/test.java b/lib/src/test/test.java index c4e73ce..f27aeb9 100644 --- a/lib/src/test/test.java +++ b/lib/src/test/test.java @@ -69,6 +69,8 @@ public class test { assertNotEquals("", dai.filename); c = new String(getFileContentPartial(dai.filename, (int) dai.offset, faviconData.length)); assertEquals(new String(faviconData), c); + + archive.dispose(); } @Test @@ -98,6 +100,8 @@ public class test { assertNotEquals("", dai.filename); c = new String(getFileContentPartial(dai.filename, (int) dai.offset, faviconData.length)); assertEquals(new String(faviconData), c); + + archive.dispose(); } @Test @@ -128,6 +132,8 @@ public class test { assertNotEquals("", dai.filename); c = new String(getFileContentPartial(dai.filename, (int) dai.offset, faviconData.length)); assertEquals(new String(faviconData), c); + + archive.dispose(); } @Test @@ -149,7 +155,7 @@ public class test { } @Test - public void testServer() throws IOException, ZimFileFormatException, JNIKiwixException { + public void testServer() throws ZimFileFormatException, JNIKiwixException { Archive archive = new Archive("small.zim"); Library lib = new Library(); Book book = new Book(); @@ -162,7 +168,7 @@ public class test { } @Test - public void testBookMark() throws IOException, ZimFileFormatException, JNIKiwixException { + public void testBookMark() throws ZimFileFormatException, JNIKiwixException { Archive archive = new Archive("small.zim"); Library lib = new Library(); Book book = new Book(); @@ -183,6 +189,18 @@ public class test { //assertEquals(true, lib.removeBookmark(bookmark.getBookId(), bookmark.getUrl())); } + @Test + public void testSearcher() throws Exception, ZimFileFormatException, JNIKiwixException { + Archive archive = new Archive("small.zim"); + Searcher searcher = new Searcher(archive); + Query query = new Query("test"); + Search search = searcher.search(query); + int matches = (int) search.getEstimatedMatches(); + assertEquals(1, matches); + SearchIterator iterator = search.getResults(0, matches); + searcher.dispose(); + } + static public void main(String[] args) { Library lib = new Library();