diff options
author | Josh Micich <josh@apache.org> | 2009-12-23 04:35:37 +0000 |
---|---|---|
committer | Josh Micich <josh@apache.org> | 2009-12-23 04:35:37 +0000 |
commit | 8221d395851c8f4b208df0a72dad9a4813f16e88 (patch) | |
tree | b7a93211ffe120d9ff0fcec893b67e409308f9ab /src/testcases/org | |
parent | 74409960b57424a3970d743a9adcdce82da1891a (diff) | |
download | poi-8221d395851c8f4b208df0a72dad9a4813f16e88.tar.gz poi-8221d395851c8f4b208df0a72dad9a4813f16e88.zip |
Simplified InterfaceHdrRecord and InterfaceEndRecord (some rework after bug 47251 / r892862).
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@893402 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org')
3 files changed, 19 insertions, 15 deletions
diff --git a/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java b/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java index d20940989f..6d913bb5df 100644 --- a/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java +++ b/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java @@ -62,6 +62,7 @@ public final class AllRecordTests { result.addTestSuite(TestFontRecord.class); result.addTestSuite(TestFormulaRecord.class); result.addTestSuite(TestHyperlinkRecord.class); + result.addTestSuite(TestInterfaceEndRecord.class); result.addTestSuite(TestLabelRecord.class); result.addTestSuite(TestMergeCellsRecord.class); result.addTestSuite(TestNameRecord.class); diff --git a/src/testcases/org/apache/poi/hssf/record/TestInterfaceEndRecord.java b/src/testcases/org/apache/poi/hssf/record/TestInterfaceEndRecord.java index 9de79b3fdf..528f8e3644 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestInterfaceEndRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestInterfaceEndRecord.java @@ -34,13 +34,14 @@ import java.io.ByteArrayInputStream; public final class TestInterfaceEndRecord extends TestCase { public void testCreate() { - InterfaceEndRecord record = new InterfaceEndRecord(); + InterfaceEndRecord record = InterfaceEndRecord.instance; assertEquals(0, record.getDataSize()); } /** * Silently swallow unexpected contents in InterfaceEndRecord. - * Although it violates the spec, Excel silently reads such files. + * Although it violates the spec, Excel silently converts this + * data to an {@link InterfaceHdrRecord}. */ public void testUnexpectedBytes_bug47251(){ String hex = "" + @@ -50,7 +51,9 @@ public final class TestInterfaceEndRecord extends TestCase { byte[] data = HexRead.readFromString(hex); List<Record> records = RecordFactory.createRecords(new ByteArrayInputStream(data)); assertEquals(3, records.size()); - InterfaceEndRecord r = (InterfaceEndRecord)records.get(1); - assertEquals("[E2, 00, 02, 00, B0, 04]", HexDump.toHex(r.serialize())); + Record rec1 = records.get(1); + assertEquals(InterfaceHdrRecord.class, rec1.getClass()); + InterfaceHdrRecord r = (InterfaceHdrRecord)rec1; + assertEquals("[E1, 00, 02, 00, B0, 04]", HexDump.toHex(r.serialize())); } -}
\ No newline at end of file +} diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestSanityChecker.java b/src/testcases/org/apache/poi/hssf/usermodel/TestSanityChecker.java index 28a24a1a75..f5839fa83b 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestSanityChecker.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestSanityChecker.java @@ -39,15 +39,15 @@ import org.apache.poi.hssf.usermodel.SanityChecker.CheckRecord; * @author Glen Stampoultzis (glens at apache.org) */ public final class TestSanityChecker extends TestCase { - + private static final Record INTERFACEHDR = new InterfaceHdrRecord(InterfaceHdrRecord.CODEPAGE); private static BoundSheetRecord createBoundSheetRec() { return new BoundSheetRecord("Sheet1"); } public void testCheckRecordOrder() { final SanityChecker c = new SanityChecker(); - List records = new ArrayList(); + List<Record> records = new ArrayList<Record>(); records.add(new BOFRecord()); - records.add(new InterfaceHdrRecord()); + records.add(INTERFACEHDR); records.add(createBoundSheetRec()); records.add(EOFRecord.instance); CheckRecord[] check = { @@ -71,15 +71,15 @@ public final class TestSanityChecker extends TestCase { confirmBadRecordOrder(check, new Record[] { new BOFRecord(), createBoundSheetRec(), - new InterfaceHdrRecord(), + INTERFACEHDR, EOFRecord.instance, }); confirmBadRecordOrder(check, new Record[] { new BOFRecord(), - new InterfaceHdrRecord(), + INTERFACEHDR, createBoundSheetRec(), - new InterfaceHdrRecord(), + INTERFACEHDR, EOFRecord.instance, }); @@ -92,19 +92,19 @@ public final class TestSanityChecker extends TestCase { }); confirmBadRecordOrder(check, new Record[] { - new InterfaceHdrRecord(), + INTERFACEHDR, createBoundSheetRec(), EOFRecord.instance, }); confirmBadRecordOrder(check, new Record[] { new BOFRecord(), - new InterfaceHdrRecord(), + INTERFACEHDR, EOFRecord.instance, }); confirmBadRecordOrder(check, new Record[] { - new InterfaceHdrRecord(), + INTERFACEHDR, createBoundSheetRec(), new BOFRecord(), EOFRecord.instance, @@ -113,7 +113,7 @@ public final class TestSanityChecker extends TestCase { confirmBadRecordOrder(check, new Record[] { new BOFRecord(), createBoundSheetRec(), - new InterfaceHdrRecord(), + INTERFACEHDR, EOFRecord.instance, }); } |