diff options
author | Javen O'Neal <onealj@apache.org> | 2016-04-17 11:25:35 +0000 |
---|---|---|
committer | Javen O'Neal <onealj@apache.org> | 2016-04-17 11:25:35 +0000 |
commit | 01bd0b4a3987865c6f1305ff47d7ad617696b9b5 (patch) | |
tree | 0c2a1945ad34c921968e75d1795b2ac8f1f58709 /src/testcases/org/apache/poi/ss | |
parent | d22bb45dfc0e5a736cbbf2e3defbb0923b0388ea (diff) | |
download | poi-01bd0b4a3987865c6f1305ff47d7ad617696b9b5.tar.gz poi-01bd0b4a3987865c6f1305ff47d7ad617696b9b5.zip |
revert r1739548 and r1739550. I could not figure out how to add BaseTestXWorkbook|Sheet|Row.java without causing junit to complain about 'Test class should have exactly one public constructor'
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1739580 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/ss')
3 files changed, 15 insertions, 20 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java index 5b22f82792..6801695399 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java @@ -36,7 +36,7 @@ import org.junit.Test; */ public abstract class BaseTestRow { - protected final ITestDataProvider _testDataProvider; + private final ITestDataProvider _testDataProvider; protected BaseTestRow(ITestDataProvider testDataProvider) { _testDataProvider = testDataProvider; @@ -72,7 +72,6 @@ public abstract class BaseTestRow { * Make sure that there is no cross-talk between rows especially with getFirstCellNum and getLastCellNum * This test was added in response to bug report 44987. */ - @Test public void testBoundsInMultipleRows() throws IOException { Workbook workbook = _testDataProvider.createWorkbook(); Sheet sheet = workbook.createSheet(); @@ -98,7 +97,6 @@ public abstract class BaseTestRow { workbook.close(); } - @Test public void testRemoveCell() throws IOException { Workbook wb1 = _testDataProvider.createWorkbook(); { @@ -141,7 +139,7 @@ public abstract class BaseTestRow { wb2.close(); } - protected void baseTestRowBounds(int maxRowNum) throws IOException { + public void baseTestRowBounds(int maxRowNum) throws IOException { Workbook workbook = _testDataProvider.createWorkbook(); Sheet sheet = workbook.createSheet(); //Test low row bound @@ -170,7 +168,7 @@ public abstract class BaseTestRow { workbook.close(); } - protected void baseTestCellBounds(int maxCellNum) throws IOException { + public void baseTestCellBounds(int maxCellNum) throws IOException { Workbook wb1 = _testDataProvider.createWorkbook(); Sheet sheet = wb1.createSheet(); @@ -213,7 +211,6 @@ public abstract class BaseTestRow { * Prior to patch 43901, POI was producing files with the wrong last-column * number on the row */ - @Test public void testLastCellNumIsCorrectAfterAddCell_bug43901() throws IOException { Workbook workbook = _testDataProvider.createWorkbook(); Sheet sheet = workbook.createSheet("test"); @@ -237,7 +234,6 @@ public abstract class BaseTestRow { /** * Tests for the missing/blank cell policy stuff */ - @Test public void testGetCellPolicy() throws IOException { Workbook workbook = _testDataProvider.createWorkbook(); Sheet sheet = workbook.createSheet("test"); @@ -309,7 +305,6 @@ public abstract class BaseTestRow { workbook.close(); } - @Test public void testRowHeight() throws IOException { Workbook wb1 = _testDataProvider.createWorkbook(); Sheet sheet = wb1.createSheet(); @@ -365,7 +360,6 @@ public abstract class BaseTestRow { /** * Test adding cells to a row in various places and see if we can find them again. */ - @Test public void testCellIterator() throws IOException { Workbook wb = _testDataProvider.createWorkbook(); Sheet sheet = wb.createSheet(); @@ -423,7 +417,6 @@ public abstract class BaseTestRow { wb.close(); } - @Test public void testRowStyle() throws IOException { Workbook wb1 = _testDataProvider.createWorkbook(); Sheet sheet = wb1.createSheet("test"); diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java index 6d81606383..830298181c 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java @@ -51,10 +51,10 @@ public abstract class BaseTestSheet { @Rule public ExpectedException thrown = ExpectedException.none(); - protected final ITestDataProvider _testDataProvider; + private final ITestDataProvider _testDataProvider; protected BaseTestSheet(ITestDataProvider testDataProvider) { - _testDataProvider = testDataProvider; + _testDataProvider = testDataProvider; } protected void trackColumnsForAutoSizingIfSXSSF(Sheet sheet) { @@ -116,9 +116,7 @@ public abstract class BaseTestSheet { } } - @Test(expected=IllegalArgumentException.class) - public void createRowAfterLastRow() throws IOException { - final SpreadsheetVersion version = _testDataProvider.getSpreadsheetVersion(); + protected void createRowAfterLastRow(SpreadsheetVersion version) throws IOException { final Workbook workbook = _testDataProvider.createWorkbook(); final Sheet sh = workbook.createSheet(); sh.createRow(version.getLastRowIndex()); @@ -130,6 +128,7 @@ public abstract class BaseTestSheet { } } + @Test public void removeRow() throws IOException { Workbook workbook = _testDataProvider.createWorkbook(); diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestWorkbook.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestWorkbook.java index 6290119f51..2169db3d59 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestWorkbook.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestWorkbook.java @@ -33,15 +33,16 @@ import java.util.Iterator; import org.apache.poi.hssf.HSSFTestDataSamples; import org.apache.poi.ss.ITestDataProvider; +import org.apache.poi.ss.SpreadsheetVersion; import org.apache.poi.ss.util.CellRangeAddress; import org.junit.Test; public abstract class BaseTestWorkbook { - protected final ITestDataProvider _testDataProvider; + private final ITestDataProvider _testDataProvider; protected BaseTestWorkbook(ITestDataProvider testDataProvider) { - _testDataProvider = testDataProvider; + _testDataProvider = testDataProvider; } @Test @@ -742,7 +743,7 @@ public abstract class BaseTestWorkbook { wb2.close(); } - protected void changeSheetNameWithSharedFormulas(String sampleFile) throws IOException { + public void changeSheetNameWithSharedFormulas(String sampleFile) throws IOException { Workbook wb = _testDataProvider.openSampleWorkbook(sampleFile); FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator(); @@ -826,9 +827,11 @@ public abstract class BaseTestWorkbook { } @Test - public void getSpreadsheetVersion() throws IOException { + public abstract void getSpreadsheetVersion() throws IOException; + + protected void verifySpreadsheetVersion(SpreadsheetVersion expected) throws IOException { final Workbook wb = _testDataProvider.createWorkbook(); - assertEquals(_testDataProvider.getSpreadsheetVersion(), wb.getSpreadsheetVersion()); + assertEquals(expected, wb.getSpreadsheetVersion()); wb.close(); } |