Separate how we test Library from how we create it.

This commit is contained in:
Matthieu Gautier 2023-06-21 16:46:37 +02:00
parent 089a7d4ba5
commit ddbf5a08c5

View File

@ -198,13 +198,8 @@ public class test {
archive.dispose(); archive.dispose();
} }
@Test private void testLibrary(TestLibrary lib)
public void testLibrary()
throws IOException { throws IOException {
TestLibrary lib = new TestLibrary();
TestManager manager = new TestManager(lib);
String content = getTextFileContent("catalog.xml");
manager.readOpds(content, "http://localhost");
assertEquals(lib.getBookCount(true, true), 1); assertEquals(lib.getBookCount(true, true), 1);
String[] bookIds = lib.getBooksIds(); String[] bookIds = lib.getBooksIds();
assertEquals(bookIds.length, 1); assertEquals(bookIds.length, 1);
@ -246,6 +241,15 @@ public class test {
assertEquals(bookIds.length, 0); assertEquals(bookIds.length, 0);
} }
@Test
public void testLibraryOPDS() throws IOException {
TestLibrary lib = new TestLibrary();
TestManager manager = new TestManager(lib);
String content = getTextFileContent("catalog.xml");
manager.readOpds(content, "http://localhost");
testLibrary(lib);
}
@Test @Test
public void testServer() throws ZimFileFormatException, JNIKiwixException { public void testServer() throws ZimFileFormatException, JNIKiwixException {
TestArchive archive = new TestArchive("small.zim"); TestArchive archive = new TestArchive("small.zim");