aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/ss/usermodel/charts
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2019-12-27 23:00:13 +0000
committerAndreas Beeker <kiwiwings@apache.org>2019-12-27 23:00:13 +0000
commitc66575c1e7059ed403b74b76e699200fdee507b4 (patch)
tree0fe96421471b53e9f72a2370ce76d61b49a659bc /src/testcases/org/apache/poi/ss/usermodel/charts
parent37282aae8f25970b157c40ae0888684f974ba666 (diff)
downloadpoi-c66575c1e7059ed403b74b76e699200fdee507b4.tar.gz
poi-c66575c1e7059ed403b74b76e699200fdee507b4.zip
Migrate all junit tests to Junit 4
get rid of references to junit.framework don't throw AssertionFailedErrors, but use Assert.fail instead add try-with-resources where it was missing git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1872041 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/ss/usermodel/charts')
-rw-r--r--src/testcases/org/apache/poi/ss/usermodel/charts/TestDataSources.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/charts/TestDataSources.java b/src/testcases/org/apache/poi/ss/usermodel/charts/TestDataSources.java
index 6bf3551286..a21be43eda 100644
--- a/src/testcases/org/apache/poi/ss/usermodel/charts/TestDataSources.java
+++ b/src/testcases/org/apache/poi/ss/usermodel/charts/TestDataSources.java
@@ -16,19 +16,24 @@
==================================================================== */
package org.apache.poi.ss.usermodel.charts;
-import junit.framework.TestCase;
+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}.
- *
- * @author Roman Kashitsyn
*/
-public class TestDataSources extends TestCase {
+@SuppressWarnings("deprecation")
+public class TestDataSources {
private static final Object[][] numericCells = {
{0.0, 1.0, 2.0, 3.0, 4.0},
@@ -44,6 +49,7 @@ public class TestDataSources extends TestCase {
{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);
@@ -52,6 +58,7 @@ public class TestDataSources extends TestCase {
assertDataSourceIsEqualToArray(doubleDataSource, doubles);
}
+ @Test
public void testStringArrayDataSource() {
String[] strings = new String[]{"one", "two", "three", "four", "five"};
ChartDataSource<String> stringDataSource = DataSources.fromArray(strings);
@@ -60,6 +67,7 @@ public class TestDataSources extends TestCase {
assertDataSourceIsEqualToArray(stringDataSource, strings);
}
+ @Test
public void testNumericCellDataSource() {
Workbook wb = new HSSFWorkbook();
Sheet sheet = new SheetBuilder(wb, numericCells).build();
@@ -74,6 +82,7 @@ public class TestDataSources extends TestCase {
}
}
+ @Test
public void testStringCellDataSource() {
Workbook wb = new HSSFWorkbook();
Sheet sheet = new SheetBuilder(wb, stringCells).build();
@@ -87,6 +96,7 @@ public class TestDataSources extends TestCase {
}
}
+ @Test
public void testMixedCellDataSource() {
Workbook wb = new HSSFWorkbook();
Sheet sheet = new SheetBuilder(wb, mixedCells).build();
@@ -105,6 +115,7 @@ public class TestDataSources extends TestCase {
}
}
+ @Test
public void testIOBExceptionOnInvalidIndex() {
Workbook wb = new HSSFWorkbook();
Sheet sheet = new SheetBuilder(wb, numericCells).build();