@@ -69,6 +69,8 @@ public void testReader()
6969 assertNotEquals ("" , dai .filename );
7070 c = new String (getFileContentPartial (dai .filename , (int ) dai .offset , faviconData .length ));
7171 assertEquals (new String (faviconData ), c );
72+
73+ archive .dispose ();
7274 }
7375
7476 @ Test
@@ -98,6 +100,8 @@ public void testReaderByFd()
98100 assertNotEquals ("" , dai .filename );
99101 c = new String (getFileContentPartial (dai .filename , (int ) dai .offset , faviconData .length ));
100102 assertEquals (new String (faviconData ), c );
103+
104+ archive .dispose ();
101105 }
102106
103107 @ Test
@@ -128,6 +132,8 @@ public void testReaderWithAnEmbeddedArchive()
128132 assertNotEquals ("" , dai .filename );
129133 c = new String (getFileContentPartial (dai .filename , (int ) dai .offset , faviconData .length ));
130134 assertEquals (new String (faviconData ), c );
135+
136+ archive .dispose ();
131137 }
132138
133139 @ Test
@@ -149,7 +155,7 @@ public void testLibrary()
149155 }
150156
151157 @ Test
152- public void testServer () throws IOException , ZimFileFormatException , JNIKiwixException {
158+ public void testServer () throws ZimFileFormatException , JNIKiwixException {
153159 Archive archive = new Archive ("small.zim" );
154160 Library lib = new Library ();
155161 Book book = new Book ();
@@ -162,7 +168,7 @@ public void testServer() throws IOException, ZimFileFormatException, JNIKiwixExc
162168 }
163169
164170 @ Test
165- public void testBookMark () throws IOException , ZimFileFormatException , JNIKiwixException {
171+ public void testBookMark () throws ZimFileFormatException , JNIKiwixException {
166172 Archive archive = new Archive ("small.zim" );
167173 Library lib = new Library ();
168174 Book book = new Book ();
@@ -183,6 +189,18 @@ public void testBookMark() throws IOException, ZimFileFormatException, JNIKiwixE
183189 //assertEquals(true, lib.removeBookmark(bookmark.getBookId(), bookmark.getUrl()));
184190 }
185191
192+ @ Test
193+ public void testSearcher () throws Exception , ZimFileFormatException , JNIKiwixException {
194+ Archive archive = new Archive ("small.zim" );
195+ Searcher searcher = new Searcher (archive );
196+ Query query = new Query ("test" );
197+ Search search = searcher .search (query );
198+ int matches = (int ) search .getEstimatedMatches ();
199+ assertEquals (1 , matches );
200+ SearchIterator iterator = search .getResults (0 , matches );
201+ searcher .dispose ();
202+ }
203+
186204 static
187205 public void main (String [] args ) {
188206 Library lib = new Library ();
0 commit comments