add junit test classes for combined testing of XML-specific functionality of (S)XSSF Workbook, Sheet, and Row

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1739550 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-04-17 08:06:30 +00:00
parent ec84916a9f
commit 144758da98
12 changed files with 127 additions and 29 deletions

View File

@ -0,0 +1,35 @@
/* ====================================================================
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.ss.usermodel;
import org.apache.poi.ss.ITestDataProvider;
import org.apache.poi.xssf.streaming.SXSSFRow;
import org.apache.poi.xssf.usermodel.XSSFRow;
/**
* Class for combined testing of XML-specific functionality of
* {@link XSSFRow} and {@link SXSSFRow}.
*
* Any test that is applicable for {@link org.apache.poi.hssf.usermodel.HSSFRow} as well should go into
* the common base class {@link BaseTestRow}.
*/
public abstract class BaseTestXRow extends BaseTestRow {
protected BaseTestXRow(ITestDataProvider testDataProvider) {
super(testDataProvider);
}
}

View File

@ -0,0 +1,35 @@
/* ====================================================================
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.ss.usermodel;
import org.apache.poi.ss.ITestDataProvider;
import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFSheet;
/**
* Class for combined testing of XML-specific functionality of
* {@link XSSFSheet} and {@link SXSSFSheet}.
*
* Any test that is applicable for {@link org.apache.poi.hssf.usermodel.HSSFSheet} as well should go into
* the common base class {@link BaseTestSheet}.
*/
public abstract class BaseTestXSheet extends BaseTestSheet {
protected BaseTestXSheet(ITestDataProvider testDataProvider) {
super(testDataProvider);
}
}

View File

@ -0,0 +1,35 @@
/* ====================================================================
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.ss.usermodel;
import org.apache.poi.ss.ITestDataProvider;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
/**
* Class for combined testing of XML-specific functionality of
* {@link XSSFWorkbook} and {@link SXSSFWorkbook}.
*
* Any test that is applicable for {@link org.apache.poi.hssf.usermodel.HSSFWorkbook} as well should go into
* the common base class {@link BaseTestWorkbook}.
*/
public abstract class BaseTestXWorkbook extends BaseTestWorkbook {
protected BaseTestXWorkbook(ITestDataProvider testDataProvider) {
super(testDataProvider);
}
}

View File

@ -22,7 +22,7 @@ package org.apache.poi.xssf.streaming;
import java.io.IOException;
import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.ss.usermodel.BaseTestRow;
import org.apache.poi.ss.usermodel.BaseTestXRow;
import org.apache.poi.xssf.SXSSFITestDataProvider;
import org.junit.After;
import org.junit.Test;
@ -30,7 +30,7 @@ import org.junit.Test;
/**
* Tests for XSSFRow
*/
public final class TestSXSSFRow extends BaseTestRow {
public final class TestSXSSFRow extends BaseTestXRow {
public TestSXSSFRow() {
super(SXSSFITestDataProvider.instance);
@ -39,7 +39,7 @@ public final class TestSXSSFRow extends BaseTestRow {
@After
public void tearDown() {
SXSSFITestDataProvider.instance.cleanup();
((SXSSFITestDataProvider) _testDataProvider).cleanup();
}
@Test

View File

@ -23,11 +23,9 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.SortedSet;
import java.util.TreeSet;
import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.ss.usermodel.BaseTestSheet;
import org.apache.poi.ss.usermodel.BaseTestXSheet;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.SXSSFITestDataProvider;
@ -36,7 +34,7 @@ import org.junit.After;
import org.junit.Test;
public class TestSXSSFSheet extends BaseTestSheet {
public final class TestSXSSFSheet extends BaseTestXSheet {
public TestSXSSFSheet() {
super(SXSSFITestDataProvider.instance);

View File

@ -32,11 +32,9 @@ import java.io.IOException;
import org.apache.poi.POIDataSamples;
import org.apache.poi.POITestCase;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.ss.usermodel.BaseTestWorkbook;
import org.apache.poi.ss.usermodel.BaseTestXWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
@ -52,16 +50,15 @@ import org.junit.Assume;
import org.junit.Ignore;
import org.junit.Test;
public final class TestSXSSFWorkbook extends BaseTestWorkbook {
private static final SXSSFITestDataProvider _testDataProvider = SXSSFITestDataProvider.instance;
public final class TestSXSSFWorkbook extends BaseTestXWorkbook {
public TestSXSSFWorkbook() {
super(_testDataProvider);
}
super(SXSSFITestDataProvider.instance);
}
@After
public void tearDown(){
_testDataProvider.cleanup();
((SXSSFITestDataProvider)_testDataProvider).cleanup();
}
/**

View File

@ -24,7 +24,7 @@ import static org.junit.Assert.assertSame;
import java.io.IOException;
import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.ss.usermodel.BaseTestRow;
import org.apache.poi.ss.usermodel.BaseTestXRow;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellCopyPolicy;
import org.apache.poi.ss.usermodel.Row;
@ -35,7 +35,7 @@ import org.junit.Test;
/**
* Tests for XSSFRow
*/
public final class TestXSSFRow extends BaseTestRow {
public final class TestXSSFRow extends BaseTestXRow {
public TestXSSFRow() {
super(XSSFITestDataProvider.instance);

View File

@ -26,7 +26,6 @@ import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.Arrays;
@ -43,7 +42,7 @@ import org.apache.poi.poifs.crypt.CryptoFunctions;
import org.apache.poi.poifs.crypt.HashAlgorithm;
import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.ss.usermodel.AutoFilter;
import org.apache.poi.ss.usermodel.BaseTestSheet;
import org.apache.poi.ss.usermodel.BaseTestXSheet;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellCopyPolicy;
import org.apache.poi.ss.usermodel.ClientAnchor;
@ -82,7 +81,7 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.STCalcMode;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STPane;
public final class TestXSSFSheet extends BaseTestSheet {
public final class TestXSSFSheet extends BaseTestXSheet {
public TestXSSFSheet() {
super(XSSFITestDataProvider.instance);

View File

@ -53,7 +53,7 @@ import org.apache.poi.openxml4j.opc.internal.FileHelper;
import org.apache.poi.openxml4j.opc.internal.MemoryPackagePart;
import org.apache.poi.openxml4j.opc.internal.PackagePropertiesPart;
import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.ss.usermodel.BaseTestWorkbook;
import org.apache.poi.ss.usermodel.BaseTestXWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
@ -77,11 +77,10 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbookPr;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STCalcMode;
public final class TestXSSFWorkbook extends BaseTestWorkbook {
private static final XSSFITestDataProvider _testDataProvider = XSSFITestDataProvider.instance;
public final class TestXSSFWorkbook extends BaseTestXWorkbook {
public TestXSSFWorkbook() {
super(_testDataProvider);
super(XSSFITestDataProvider.instance);
}
/**

View File

@ -36,7 +36,7 @@ import org.junit.Test;
*/
public abstract class BaseTestRow {
private final ITestDataProvider _testDataProvider;
protected final ITestDataProvider _testDataProvider;
protected BaseTestRow(ITestDataProvider testDataProvider) {
_testDataProvider = testDataProvider;

View File

@ -51,10 +51,10 @@ public abstract class BaseTestSheet {
@Rule
public ExpectedException thrown = ExpectedException.none();
private final ITestDataProvider _testDataProvider;
protected final ITestDataProvider _testDataProvider;
protected BaseTestSheet(ITestDataProvider testDataProvider) {
_testDataProvider = testDataProvider;
_testDataProvider = testDataProvider;
}
protected void trackColumnsForAutoSizingIfSXSSF(Sheet sheet) {

View File

@ -39,10 +39,10 @@ import org.junit.Test;
public abstract class BaseTestWorkbook {
private final ITestDataProvider _testDataProvider;
protected final ITestDataProvider _testDataProvider;
protected BaseTestWorkbook(ITestDataProvider testDataProvider) {
_testDataProvider = testDataProvider;
_testDataProvider = testDataProvider;
}
@Test