Make the test generic across POIFS and NPOIFS
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1675698 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f8977f76d0
commit
d540ba43cc
@ -34,15 +34,22 @@ public final class TestFileSystemBugs extends TestCase {
|
|||||||
public void testNotesOLE2Files() throws Exception {
|
public void testNotesOLE2Files() throws Exception {
|
||||||
POIDataSamples _samples = POIDataSamples.getPOIFSInstance();
|
POIDataSamples _samples = POIDataSamples.getPOIFSInstance();
|
||||||
|
|
||||||
// Open the file up
|
// Open the file up with the two FileSystems
|
||||||
POIFSFileSystem fs = new POIFSFileSystem(
|
@SuppressWarnings("resource")
|
||||||
|
DirectoryNode[] roots = new DirectoryNode[] {
|
||||||
|
new POIFSFileSystem(
|
||||||
_samples.openResourceAsStream("Notes.ole2")
|
_samples.openResourceAsStream("Notes.ole2")
|
||||||
);
|
).getRoot(),
|
||||||
|
new NPOIFSFileSystem(
|
||||||
|
_samples.openResourceAsStream("Notes.ole2")
|
||||||
|
).getRoot()
|
||||||
|
};
|
||||||
|
|
||||||
// Check the contents
|
// Check the contents
|
||||||
assertEquals(1, fs.getRoot().getEntryCount());
|
for (DirectoryNode root : roots) {
|
||||||
|
assertEquals(1, root.getEntryCount());
|
||||||
|
|
||||||
Entry entry = fs.getRoot().getEntries().next();
|
Entry entry = root.getEntries().next();
|
||||||
assertTrue(entry.isDirectoryEntry());
|
assertTrue(entry.isDirectoryEntry());
|
||||||
assertTrue(entry instanceof DirectoryEntry);
|
assertTrue(entry instanceof DirectoryEntry);
|
||||||
|
|
||||||
@ -62,5 +69,10 @@ public final class TestFileSystemBugs extends TestCase {
|
|||||||
entry = it.next();
|
entry = it.next();
|
||||||
assertEquals(true, entry.isDocumentEntry());
|
assertEquals(true, entry.isDocumentEntry());
|
||||||
assertEquals("\u0001CompObj", entry.getName());
|
assertEquals("\u0001CompObj", entry.getName());
|
||||||
|
|
||||||
|
// Tidy
|
||||||
|
if (root.getNFileSystem() != null)
|
||||||
|
root.getNFileSystem().close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user