diff --git a/src/testcases/org/apache/poi/ss/util/TestCellUtil.java b/src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java similarity index 90% rename from src/testcases/org/apache/poi/ss/util/TestCellUtil.java rename to src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java index a0de297840..59609bfbe2 100644 --- a/src/testcases/org/apache/poi/ss/util/TestCellUtil.java +++ b/src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java @@ -27,7 +27,7 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.ITestDataProvider; import org.apache.poi.ss.usermodel.BorderStyle; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; @@ -42,10 +42,16 @@ import org.junit.Test; * * @see org.apache.poi.ss.util.CellUtil */ -public final class TestCellUtil { +public class BaseTestCellUtil { + protected final ITestDataProvider _testDataProvider; + + protected BaseTestCellUtil(ITestDataProvider testDataProvider) { + _testDataProvider = testDataProvider; + } + @Test public void setCellStyleProperty() throws IOException { - Workbook wb = new HSSFWorkbook(); + Workbook wb = _testDataProvider.createWorkbook(); Sheet s = wb.createSheet(); Row r = s.createRow(0); Cell c = r.createCell(0); @@ -67,7 +73,7 @@ public final class TestCellUtil { @Test public void setCellStyleProperties() throws IOException { - Workbook wb = new HSSFWorkbook(); + Workbook wb = _testDataProvider.createWorkbook(); Sheet s = wb.createSheet(); Row r = s.createRow(0); Cell c = r.createCell(0); @@ -94,7 +100,7 @@ public final class TestCellUtil { @Test public void getRow() throws IOException { - Workbook wb = new HSSFWorkbook(); + Workbook wb = _testDataProvider.createWorkbook(); Sheet sh = wb.createSheet(); Row row1 = sh.createRow(0); @@ -111,7 +117,7 @@ public final class TestCellUtil { @Test public void getCell() throws IOException { - Workbook wb = new HSSFWorkbook(); + Workbook wb = _testDataProvider.createWorkbook(); Sheet sh = wb.createSheet(); Row row = sh.createRow(0); Cell A1 = row.createCell(0); @@ -129,7 +135,7 @@ public final class TestCellUtil { @Test public void createCell() throws IOException { - Workbook wb = new HSSFWorkbook(); + Workbook wb = _testDataProvider.createWorkbook(); Sheet sh = wb.createSheet(); Row row = sh.createRow(0); @@ -165,7 +171,7 @@ public final class TestCellUtil { @Test public void setAlignment() throws IOException { - Workbook wb = new HSSFWorkbook(); + Workbook wb = _testDataProvider.createWorkbook(); Sheet sh = wb.createSheet(); Row row = sh.createRow(0); Cell A1 = row.createCell(0); @@ -193,7 +199,7 @@ public final class TestCellUtil { @Test public void setFont() throws IOException { - Workbook wb = new HSSFWorkbook(); + Workbook wb = _testDataProvider.createWorkbook(); Sheet sh = wb.createSheet(); Row row = sh.createRow(0); Cell A1 = row.createCell(0); @@ -226,8 +232,8 @@ public final class TestCellUtil { @Test public void setFontFromDifferentWorkbook() throws IOException { - Workbook wb1 = new HSSFWorkbook(); - Workbook wb2 = new HSSFWorkbook(); + Workbook wb1 = _testDataProvider.createWorkbook(); + Workbook wb2 = _testDataProvider.createWorkbook(); Font font1 = wb1.createFont(); Font font2 = wb2.createFont(); // do something to make font1 and font2 different diff --git a/src/testcases/org/apache/poi/ss/util/TestHSSFCellUtil.java b/src/testcases/org/apache/poi/ss/util/TestHSSFCellUtil.java new file mode 100644 index 0000000000..848d32a113 --- /dev/null +++ b/src/testcases/org/apache/poi/ss/util/TestHSSFCellUtil.java @@ -0,0 +1,26 @@ +/* ==================================================================== + 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.util; + +import org.apache.poi.hssf.HSSFITestDataProvider; + +public class TestHSSFCellUtil extends BaseTestCellUtil { + public TestHSSFCellUtil() { + super(HSSFITestDataProvider.instance); + } +} \ No newline at end of file