From 4fd05fac12a32de2e6312e93c463277a40b6ff20 Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Sun, 12 Apr 2020 22:03:52 +0000 Subject: #63745 - Add traversing and debugging interface to HSSF This makes toString() implementations obsolete. This also contains preparation for #64036 to (maybe) change the record factory interface of HSSF. Remove duplicated record SeriesToChartGroupRecord, which is a duplicate of SeriesChartGroupIndexRecord. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1876433 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/hssf/record/chart/AllChartRecordTests.java | 1 - .../record/chart/TestSeriesToChartGroupRecord.java | 54 ---------------------- .../poi/hssf/usermodel/TestHSSFWorkbook.java | 13 ++++++ .../apache/poi/ss/formula/ptg/TestArrayPtg.java | 2 +- 4 files changed, 14 insertions(+), 56 deletions(-) delete mode 100644 src/testcases/org/apache/poi/hssf/record/chart/TestSeriesToChartGroupRecord.java (limited to 'src/testcases/org/apache') diff --git a/src/testcases/org/apache/poi/hssf/record/chart/AllChartRecordTests.java b/src/testcases/org/apache/poi/hssf/record/chart/AllChartRecordTests.java index 84b07e9d76..0f0c698681 100644 --- a/src/testcases/org/apache/poi/hssf/record/chart/AllChartRecordTests.java +++ b/src/testcases/org/apache/poi/hssf/record/chart/AllChartRecordTests.java @@ -56,7 +56,6 @@ import org.junit.runners.Suite; TestSeriesListRecord.class, TestSeriesRecord.class, TestSeriesTextRecord.class, - TestSeriesToChartGroupRecord.class, TestSheetPropertiesRecord.class, TestTextRecord.class, TestTickRecord.class, diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesToChartGroupRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesToChartGroupRecord.java deleted file mode 100644 index 9f24bb5637..0000000000 --- a/src/testcases/org/apache/poi/hssf/record/chart/TestSeriesToChartGroupRecord.java +++ /dev/null @@ -1,54 +0,0 @@ -/* ==================================================================== - 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.chart; - - -import static org.apache.poi.hssf.record.TestcaseRecordInputStream.confirmRecordEncoding; -import static org.junit.Assert.assertEquals; - -import org.apache.poi.hssf.record.TestcaseRecordInputStream; -import org.junit.Test; - -/** - * Tests the serialization and deserialization of the SeriesToChartGroupRecord - * class works correctly. Test data taken directly from a real - * Excel file. - */ -public final class TestSeriesToChartGroupRecord { - byte[] data = new byte[] { - (byte)0x0, (byte)0x0 - }; - - @Test - public void testLoad() { - SeriesToChartGroupRecord record = new SeriesToChartGroupRecord(TestcaseRecordInputStream.create(0x1045, data)); - assertEquals( 0x0, record.getChartGroupIndex()); - - assertEquals( 0x6, record.getRecordSize() ); - } - - @SuppressWarnings("squid:S2699") - @Test - public void testStore() { - SeriesToChartGroupRecord record = new SeriesToChartGroupRecord(); - record.setChartGroupIndex( (short)0x0 ); - - byte [] recordBytes = record.serialize(); - confirmRecordEncoding(SeriesToChartGroupRecord.sid, data, recordBytes); - } -} diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java index be7dda1f34..fde0d769d2 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java @@ -36,6 +36,8 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Map; +import java.util.function.Supplier; import org.apache.poi.POIDataSamples; import org.apache.poi.ddf.EscherBSERecord; @@ -47,6 +49,7 @@ import org.apache.poi.hssf.model.HSSFFormulaParser; import org.apache.poi.hssf.model.InternalSheet; import org.apache.poi.hssf.model.InternalWorkbook; import org.apache.poi.hssf.record.CFRuleRecord; +import org.apache.poi.hssf.record.HSSFRecordTypes; import org.apache.poi.hssf.record.NameRecord; import org.apache.poi.hssf.record.Record; import org.apache.poi.hssf.record.RecordBase; @@ -507,6 +510,16 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook { public BadlyBehavedRecord copy() { return null; } + + @Override + public HSSFRecordTypes getGenericRecordType() { + return null; + } + + @Override + public Map> getGenericProperties() { + return null; + } } /** diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestArrayPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestArrayPtg.java index d59e0c1866..960209681b 100644 --- a/src/testcases/org/apache/poi/ss/formula/ptg/TestArrayPtg.java +++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestArrayPtg.java @@ -49,7 +49,7 @@ public final class TestArrayPtg { }; private static ArrayPtg create(byte[] initialData, byte[] constantData) { - ArrayPtg.Initial ptgInit = new ArrayPtg.Initial(TestcaseRecordInputStream.createLittleEndian(initialData)); + ArrayInitialPtg ptgInit = new ArrayInitialPtg(TestcaseRecordInputStream.createLittleEndian(initialData)); return ptgInit.finishReading(TestcaseRecordInputStream.createLittleEndian(constantData)); } -- cgit v1.2.3