diff options
author | Nick Burch <nick@apache.org> | 2010-12-23 07:08:50 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2010-12-23 07:08:50 +0000 |
commit | de3d20d51a8d97e4b5272e12419affe3279d7e58 (patch) | |
tree | 37ecec5ca3e08e8dab7ddd8831bf8bf140342e95 /src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java | |
parent | c4b00f8592f5222f2674229b1be4f1bdb1fb2e0e (diff) | |
download | poi-de3d20d51a8d97e4b5272e12419affe3279d7e58.tar.gz poi-de3d20d51a8d97e4b5272e12419affe3279d7e58.zip |
More NPOIFSFileSystem and NPOIFSStream read unit tests, along with details of a few more tests still to be written
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1052186 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java')
-rw-r--r-- | src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java b/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java index 62ce21a890..c511df3741 100644 --- a/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java +++ b/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java @@ -17,6 +17,8 @@ package org.apache.poi.poifs.filesystem; +import java.nio.ByteBuffer; + import junit.framework.TestCase; import org.apache.poi.POIDataSamples; @@ -116,6 +118,32 @@ public final class TestNPOIFSFileSystem extends TestCase { * Check we get the right data back for each block */ public void testGetBlock() throws Exception { - // TODO + NPOIFSFileSystem fs = new NPOIFSFileSystem(_inst.getFile("BlockSize512.zvi")); + ByteBuffer b; + + // The 0th block is the first data block + b = fs.getBlockAt(0); + assertEquals((byte)0x9e, b.get()); + assertEquals((byte)0x75, b.get()); + assertEquals((byte)0x97, b.get()); + assertEquals((byte)0xf6, b.get()); + + // And the next block + b = fs.getBlockAt(1); + assertEquals((byte)0x86, b.get()); + assertEquals((byte)0x09, b.get()); + assertEquals((byte)0x22, b.get()); + assertEquals((byte)0xfb, b.get()); + + // Check the final block too + b = fs.getBlockAt(99); + assertEquals((byte)0x01, b.get()); + assertEquals((byte)0x00, b.get()); + assertEquals((byte)0x00, b.get()); + assertEquals((byte)0x00, b.get()); + assertEquals((byte)0x02, b.get()); + assertEquals((byte)0x00, b.get()); + assertEquals((byte)0x00, b.get()); + assertEquals((byte)0x00, b.get()); } } |