mirror of
https://github.com/kiwix/java-libkiwix.git
synced 2025-09-09 23:30:34 -04:00
Fix indentation.
This commit is contained in:
parent
9d6ef87b57
commit
36ad3c0331
@ -22,8 +22,8 @@ public class test {
|
|||||||
throws IOException {
|
throws IOException {
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
DataInputStream in = new DataInputStream(
|
DataInputStream in = new DataInputStream(
|
||||||
new BufferedInputStream(
|
new BufferedInputStream(
|
||||||
new FileInputStream(file)));
|
new FileInputStream(file)));
|
||||||
byte[] data = new byte[(int) file.length()];
|
byte[] data = new byte[(int) file.length()];
|
||||||
in.read(data);
|
in.read(data);
|
||||||
return data;
|
return data;
|
||||||
@ -33,8 +33,8 @@ public class test {
|
|||||||
throws IOException {
|
throws IOException {
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
DataInputStream in = new DataInputStream(
|
DataInputStream in = new DataInputStream(
|
||||||
new BufferedInputStream(
|
new BufferedInputStream(
|
||||||
new FileInputStream(file)));
|
new FileInputStream(file)));
|
||||||
byte[] data = new byte[size];
|
byte[] data = new byte[size];
|
||||||
in.skipBytes(offset);
|
in.skipBytes(offset);
|
||||||
in.read(data, 0, size);
|
in.read(data, 0, size);
|
||||||
@ -47,7 +47,7 @@ public class test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void testArchive(TestArchive archive)
|
private void testArchive(TestArchive archive)
|
||||||
throws IOException, EntryNotFoundException {
|
throws IOException, EntryNotFoundException {
|
||||||
// test the zim file main page title
|
// test the zim file main page title
|
||||||
TestEntry mainPage = archive.getMainEntry();
|
TestEntry mainPage = archive.getMainEntry();
|
||||||
assertTrue(mainPage.isRedirect());
|
assertTrue(mainPage.isRedirect());
|
||||||
@ -94,8 +94,8 @@ public class test {
|
|||||||
assertTrue(Arrays.equals(illuSizes, archive.getIllustrationSizes()));
|
assertTrue(Arrays.equals(illuSizes, archive.getIllustrationSizes()));
|
||||||
String[] metaKeys = {"Counter", "Creator", "Date", "Description", "Illustration_48x48@1", "Language", "LongDescription", "Name", "Publisher", "Scraper", "Tags", "Title"};
|
String[] metaKeys = {"Counter", "Creator", "Date", "Description", "Illustration_48x48@1", "Language", "LongDescription", "Name", "Publisher", "Scraper", "Tags", "Title"};
|
||||||
assertTrue(Arrays.equals(
|
assertTrue(Arrays.equals(
|
||||||
metaKeys,
|
metaKeys,
|
||||||
archive.getMetadataKeys()
|
archive.getMetadataKeys()
|
||||||
));
|
));
|
||||||
assertEquals("e34f5109-ed0d-b93e-943d-06f7717c7340", archive.getUuid());
|
assertEquals("e34f5109-ed0d-b93e-943d-06f7717c7340", archive.getUuid());
|
||||||
assertEquals(1, archive.getMediaCount());
|
assertEquals(1, archive.getMediaCount());
|
||||||
@ -118,58 +118,58 @@ public class test {
|
|||||||
|
|
||||||
// Test different iterators
|
// Test different iterators
|
||||||
{
|
{
|
||||||
TestEntryIterator iter = archive.iterByPath();
|
TestEntryIterator iter = archive.iterByPath();
|
||||||
assertTrue(iter.hasNext());
|
assertTrue(iter.hasNext());
|
||||||
assertEquals("favicon.png", iter.next().getPath());
|
assertEquals("favicon.png", iter.next().getPath());
|
||||||
assertEquals("main.html", iter.next().getPath());
|
assertEquals("main.html", iter.next().getPath());
|
||||||
assertFalse(iter.hasNext());
|
assertFalse(iter.hasNext());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
TestEntryIterator iter = archive.iterByTitle();
|
TestEntryIterator iter = archive.iterByTitle();
|
||||||
assertTrue(iter.hasNext());
|
assertTrue(iter.hasNext());
|
||||||
assertEquals("main.html", iter.next().getPath());
|
assertEquals("main.html", iter.next().getPath());
|
||||||
// No favicon, because favicon is not a main article (no title)
|
// No favicon, because favicon is not a main article (no title)
|
||||||
assertFalse(iter.hasNext());
|
assertFalse(iter.hasNext());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
TestEntryIterator iter = archive.iterEfficient();
|
TestEntryIterator iter = archive.iterEfficient();
|
||||||
assertTrue(iter.hasNext());
|
assertTrue(iter.hasNext());
|
||||||
assertEquals("main.html", iter.next().getPath());
|
assertEquals("main.html", iter.next().getPath());
|
||||||
assertEquals("favicon.png", iter.next().getPath());
|
assertEquals("favicon.png", iter.next().getPath());
|
||||||
assertFalse(iter.hasNext());
|
assertFalse(iter.hasNext());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
TestEntryIterator iter = archive.findByPath("ma");
|
TestEntryIterator iter = archive.findByPath("ma");
|
||||||
assertTrue(iter.hasNext());
|
assertTrue(iter.hasNext());
|
||||||
assertEquals("main.html", iter.next().getPath());
|
assertEquals("main.html", iter.next().getPath());
|
||||||
assertFalse(iter.hasNext());
|
assertFalse(iter.hasNext());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
TestEntryIterator iter = archive.findByTitle("Test");
|
TestEntryIterator iter = archive.findByTitle("Test");
|
||||||
assertTrue(iter.hasNext());
|
assertTrue(iter.hasNext());
|
||||||
assertEquals("main.html", iter.next().getPath());
|
assertEquals("main.html", iter.next().getPath());
|
||||||
assertFalse(iter.hasNext());
|
assertFalse(iter.hasNext());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test invalid path
|
// Test invalid path
|
||||||
try {
|
try {
|
||||||
archive.getEntryByTitle("Wrong title");
|
archive.getEntryByTitle("Wrong title");
|
||||||
} catch(EntryNotFoundException e) {
|
} catch(EntryNotFoundException e) {
|
||||||
assertEquals("Cannot find entry", e.getMessage());
|
assertEquals("Cannot find entry", e.getMessage());
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
fail("ERROR: Must be a EntryNotFoundException.");
|
fail("ERROR: Must be a EntryNotFoundException.");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
archive.getEntryByPath("wrong_path.html");
|
archive.getEntryByPath("wrong_path.html");
|
||||||
} catch(EntryNotFoundException e) {
|
} catch(EntryNotFoundException e) {
|
||||||
assertEquals("Cannot find entry", e.getMessage());
|
assertEquals("Cannot find entry", e.getMessage());
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
fail("ERROR: Must be a EntryNotFoundException.");
|
fail("ERROR: Must be a EntryNotFoundException.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user