diff options
author | PJ Fanning <fanningpj@apache.org> | 2020-06-27 13:58:23 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2020-06-27 13:58:23 +0000 |
commit | 883d6bb987d50aec411e92140958b2af04b68f7c (patch) | |
tree | add74b4dfa2bf4225a21223de696029e808d0d91 /src/testcases | |
parent | c3ed1acbc746ab61851cc5f807b6f63ed8b839b5 (diff) | |
download | poi-883d6bb987d50aec411e92140958b2af04b68f7c.tar.gz poi-883d6bb987d50aec411e92140958b2af04b68f7c.zip |
remove some deprecated classes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1879276 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
-rw-r--r-- | src/testcases/org/apache/poi/ss/formula/functions/TestAreas.java | 2 | ||||
-rw-r--r-- | src/testcases/org/apache/poi/ss/usermodel/charts/TestDataSources.java | 147 |
2 files changed, 1 insertions, 148 deletions
diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestAreas.java b/src/testcases/org/apache/poi/ss/formula/functions/TestAreas.java index 8f86a16a24..08de5131de 100644 --- a/src/testcases/org/apache/poi/ss/formula/functions/TestAreas.java +++ b/src/testcases/org/apache/poi/ss/formula/functions/TestAreas.java @@ -54,7 +54,7 @@ public final class TestAreas { cell.setCellFormula(formulaText); fe.notifyUpdateCell(cell); CellValue result = fe.evaluate(cell); - assertEquals(result.getCellTypeEnum(), CellType.NUMERIC); + assertEquals(result.getCellType(), CellType.NUMERIC); assertEquals(expectedResult, result.getNumberValue(), 0); } } diff --git a/src/testcases/org/apache/poi/ss/usermodel/charts/TestDataSources.java b/src/testcases/org/apache/poi/ss/usermodel/charts/TestDataSources.java deleted file mode 100644 index a21be43eda..0000000000 --- a/src/testcases/org/apache/poi/ss/usermodel/charts/TestDataSources.java +++ /dev/null @@ -1,147 +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.ss.usermodel.charts; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.ss.util.CellRangeAddress; -import org.apache.poi.ss.util.SheetBuilder; -import org.junit.Test; - -/** - * Tests for {@link org.apache.poi.ss.usermodel.charts.DataSources}. - */ -@SuppressWarnings("deprecation") -public class TestDataSources { - - private static final Object[][] numericCells = { - {0.0, 1.0, 2.0, 3.0, 4.0}, - {0.0, "=B1*2", "=C1*2", "=D1*2", "=E1*2"} - }; - - private static final Object[][] stringCells = { - { 1, 2, 3, 4, 5}, - {"A", "B", "C", "D", "E"} - }; - - private static final Object[][] mixedCells = { - {1.0, "2.0", 3.0, "4.0", 5.0, "6.0"} - }; - - @Test - public void testNumericArrayDataSource() { - Double[] doubles = new Double[]{1.0, 2.0, 3.0, 4.0, 5.0}; - ChartDataSource<Double> doubleDataSource = DataSources.fromArray(doubles); - assertTrue(doubleDataSource.isNumeric()); - assertFalse(doubleDataSource.isReference()); - assertDataSourceIsEqualToArray(doubleDataSource, doubles); - } - - @Test - public void testStringArrayDataSource() { - String[] strings = new String[]{"one", "two", "three", "four", "five"}; - ChartDataSource<String> stringDataSource = DataSources.fromArray(strings); - assertFalse(stringDataSource.isNumeric()); - assertFalse(stringDataSource.isReference()); - assertDataSourceIsEqualToArray(stringDataSource, strings); - } - - @Test - public void testNumericCellDataSource() { - Workbook wb = new HSSFWorkbook(); - Sheet sheet = new SheetBuilder(wb, numericCells).build(); - CellRangeAddress numCellRange = CellRangeAddress.valueOf("A2:E2"); - ChartDataSource<Number> numDataSource = DataSources.fromNumericCellRange(sheet, numCellRange); - assertTrue(numDataSource.isReference()); - assertTrue(numDataSource.isNumeric()); - assertEquals(numericCells[0].length, numDataSource.getPointCount()); - for (int i = 0; i < numericCells[0].length; ++i) { - assertEquals(((Number) numericCells[0][i]).doubleValue() * 2, - numDataSource.getPointAt(i).doubleValue(), 0.00001); - } - } - - @Test - public void testStringCellDataSource() { - Workbook wb = new HSSFWorkbook(); - Sheet sheet = new SheetBuilder(wb, stringCells).build(); - CellRangeAddress numCellRange = CellRangeAddress.valueOf("A2:E2"); - ChartDataSource<String> numDataSource = DataSources.fromStringCellRange(sheet, numCellRange); - assertTrue(numDataSource.isReference()); - assertFalse(numDataSource.isNumeric()); - assertEquals(numericCells[0].length, numDataSource.getPointCount()); - for (int i = 0; i < stringCells[1].length; ++i) { - assertEquals(stringCells[1][i], numDataSource.getPointAt(i)); - } - } - - @Test - public void testMixedCellDataSource() { - Workbook wb = new HSSFWorkbook(); - Sheet sheet = new SheetBuilder(wb, mixedCells).build(); - CellRangeAddress mixedCellRange = CellRangeAddress.valueOf("A1:F1"); - ChartDataSource<String> strDataSource = DataSources.fromStringCellRange(sheet, mixedCellRange); - ChartDataSource<Number> numDataSource = DataSources.fromNumericCellRange(sheet, mixedCellRange); - for (int i = 0; i < mixedCells[0].length; ++i) { - if (i % 2 == 0) { - assertNull(strDataSource.getPointAt(i)); - assertEquals(((Number) mixedCells[0][i]).doubleValue(), - numDataSource.getPointAt(i).doubleValue(), 0.00001); - } else { - assertNull(numDataSource.getPointAt(i)); - assertEquals(mixedCells[0][i], strDataSource.getPointAt(i)); - } - } - } - - @Test - public void testIOBExceptionOnInvalidIndex() { - Workbook wb = new HSSFWorkbook(); - Sheet sheet = new SheetBuilder(wb, numericCells).build(); - CellRangeAddress rangeAddress = CellRangeAddress.valueOf("A2:E2"); - ChartDataSource<Number> numDataSource = DataSources.fromNumericCellRange(sheet, rangeAddress); - IndexOutOfBoundsException exception = null; - try { - numDataSource.getPointAt(-1); - } catch (IndexOutOfBoundsException e) { - exception = e; - } - assertNotNull(exception); - - exception = null; - try { - numDataSource.getPointAt(numDataSource.getPointCount()); - } catch (IndexOutOfBoundsException e) { - exception = e; - } - assertNotNull(exception); - } - - private <T> void assertDataSourceIsEqualToArray(ChartDataSource<T> ds, T[] array) { - assertEquals(ds.getPointCount(), array.length); - for (int i = 0; i < array.length; ++i) { - assertEquals(ds.getPointAt(i), array[i]); - } - } -} |