Introduce TestEntry.java

This commit is contained in:
Matthieu Gautier 2023-06-13 17:38:18 +02:00
parent d4f2f82e98
commit ff6469a34f
2 changed files with 43 additions and 8 deletions

View File

@ -20,7 +20,6 @@
package org.kiwix.test.libzim;
import org.kiwix.libzim.ZimFileFormatException;
import org.kiwix.libzim.Entry;
import org.kiwix.libzim.Item;
import org.kiwix.libzim.EntryIterator;
import org.kiwix.libzim.Archive;
@ -62,20 +61,20 @@ public class TestArchive
public boolean hasIllustration(int size) { return inner.hasIllustration(size); }
public long[] getIllustrationSizes() { return inner.getIllustrationSizes(); }
public Entry getEntryByPath(String path) { return inner.getEntryByPath(path); }
public Entry getEntryByPath(int index) { return inner.getEntryByPath(index); }
public TestEntry getEntryByPath(String path) { return new TestEntry(inner.getEntryByPath(path)); }
public TestEntry getEntryByPath(int index) { return new TestEntry(inner.getEntryByPath(index)); }
public boolean hasEntryByPath(String path) { return inner.hasEntryByPath(path); }
public Entry getEntryByTitle(String title) { return inner.getEntryByTitle(title); }
public Entry getEntryByTitle(int index) { return inner.getEntryByTitle(index); }
public TestEntry getEntryByTitle(String title) { return new TestEntry(inner.getEntryByTitle(title)); }
public TestEntry getEntryByTitle(int index) { return new TestEntry(inner.getEntryByTitle(index)); }
public boolean hasEntryByTitle(String title) { return inner.hasEntryByTitle(title); }
public Entry getEntryByClusterOrder(int index) { return inner.getEntryByClusterOrder(index); }
public TestEntry getEntryByClusterOrder(int index) { return new TestEntry(inner.getEntryByClusterOrder(index)); }
public Entry getMainEntry() { return inner.getMainEntry(); }
public TestEntry getMainEntry() { return new TestEntry(inner.getMainEntry()); }
public boolean hasMainEntry() { return inner.hasMainEntry(); }
public Entry getRandomEntry() { return inner.getRandomEntry(); }
public TestEntry getRandomEntry() { return new TestEntry(inner.getRandomEntry()); }
public boolean hasFulltextIndex() { return inner.hasFulltextIndex(); }
public boolean hasTitleIndex() { return inner.hasTitleIndex(); }

View File

@ -0,0 +1,36 @@
/*
* Copyright (C) 2022 Matthieu Gautier <mgautier@kymeria.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.kiwix.test.libzim;
import org.kiwix.libzim.Entry;
import org.kiwix.libzim.Item;
public class TestEntry
{
private Entry inner;
public TestEntry(Entry _inner) { inner = _inner; }
public boolean isRedirect() { return inner.isRedirect(); }
public String getTitle() { return inner.getTitle(); }
public String getPath() { return inner.getPath(); }
public Item getItem(boolean follow) { return inner.getItem(follow); }
public Item getRedirect() { return inner.getRedirect(); }
public TestEntry getRedirectEntry() { return new TestEntry(inner.getRedirectEntry()); }
}