aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache
diff options
context:
space:
mode:
authorJosh Micich <josh@apache.org>2008-03-27 20:03:29 +0000
committerJosh Micich <josh@apache.org>2008-03-27 20:03:29 +0000
commit44c475cd46669c733cad15d383059f9fc2e53721 (patch)
tree502e4761165190d68687b5965907e3eb899768df /src/testcases/org/apache
parent47d3a87a5c7263135c1fa64b1d8570c7c67d3d60 (diff)
downloadpoi-44c475cd46669c733cad15d383059f9fc2e53721.tar.gz
poi-44c475cd46669c733cad15d383059f9fc2e53721.zip
fixes for ExternalNameRecord serialisation bug #44691
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@641964 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache')
-rwxr-xr-xsrc/testcases/org/apache/poi/hssf/record/AllRecordTests.java6
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestExternalNameRecord.java55
2 files changed, 58 insertions, 3 deletions
diff --git a/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java b/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java
index b1acfeafa1..9da8f45ebc 100755
--- a/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java
+++ b/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java
@@ -14,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.hssf.record;
@@ -28,10 +27,10 @@ import junit.framework.TestSuite;
*
* @author Josh Micich
*/
-public class AllRecordTests {
+public final class AllRecordTests {
public static Test suite() {
- TestSuite result = new TestSuite("Tests for org.apache.poi.hssf.record");
+ TestSuite result = new TestSuite(AllRecordTests.class.getName());
result.addTest(AllFormulaTests.suite());
@@ -56,6 +55,7 @@ public class AllRecordTests {
result.addTestSuite(TestEmbeddedObjectRefSubRecord.class);
result.addTestSuite(TestEndSubRecord.class);
result.addTestSuite(TestEscherAggregate.class);
+ result.addTestSuite(TestExternalNameRecord.class);
result.addTestSuite(TestFontBasisRecord.class);
result.addTestSuite(TestFontIndexRecord.class);
result.addTestSuite(TestFormulaRecord.class);
diff --git a/src/testcases/org/apache/poi/hssf/record/TestExternalNameRecord.java b/src/testcases/org/apache/poi/hssf/record/TestExternalNameRecord.java
new file mode 100644
index 0000000000..a90221f5e6
--- /dev/null
+++ b/src/testcases/org/apache/poi/hssf/record/TestExternalNameRecord.java
@@ -0,0 +1,55 @@
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+package org.apache.poi.hssf.record;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+/**
+ *
+ * @author Josh Micich
+ */
+public final class TestExternalNameRecord extends TestCase {
+
+ private static final byte[] dataFDS = {
+ 0, 0, 0, 0, 0, 0, 3, 0, 70, 68, 83, 0, 0,
+ };
+ private static ExternalNameRecord createSimpleENR() {
+ return new ExternalNameRecord(new TestcaseRecordInputStream((short)0x0023, dataFDS));
+ }
+ public void testBasicDeserializeReserialize() {
+
+ ExternalNameRecord enr = createSimpleENR();
+ assertEquals( "FDS", enr.getText());
+
+ try {
+ TestcaseRecordInputStream.confirmRecordEncoding(0x0023, dataFDS, enr.serialize());
+ } catch (ArrayIndexOutOfBoundsException e) {
+ if(e.getMessage().equals("15")) {
+ throw new AssertionFailedError("Identified bug 44691");
+ }
+ }
+ }
+
+ public void testBasicSize() {
+ ExternalNameRecord enr = createSimpleENR();
+ if(enr.getRecordSize() == 13) {
+ throw new AssertionFailedError("Identified bug 44691");
+ }
+ assertEquals(17, enr.getRecordSize());
+ }
+}