Replace deprecated methods used in tests

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885886 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alain Béarez 2021-01-24 20:01:36 +00:00
parent 54fde895e6
commit ed836507e5
7 changed files with 10 additions and 10 deletions

View File

@ -137,7 +137,7 @@ public final class ExcelChartWithTargetLine {
} }
XDDFScatterChartData scatter = (XDDFScatterChartData) chart.createData(ChartTypes.SCATTER, scatterX, scatterY); XDDFScatterChartData scatter = (XDDFScatterChartData) chart.createData(ChartTypes.SCATTER, scatterX, scatterY);
scatter.setVaryColors(true); scatter.setVaryColors(false);
// This only works for Excel since OpenOffice or LibreOffice Calc does not support literal numeric data series. // This only works for Excel since OpenOffice or LibreOffice Calc does not support literal numeric data series.
XDDFNumericalDataSource<Double> targetDS = XDDFDataSourcesFactory.fromArray(new Double[] { target, target }); XDDFNumericalDataSource<Double> targetDS = XDDFDataSourcesFactory.fromArray(new Double[] { target, target });

View File

@ -63,7 +63,7 @@ public final class BarChartExample {
} }
try (FileInputStream argIS = new FileInputStream(args[0]); try (FileInputStream argIS = new FileInputStream(args[0]);
BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[1]), StandardCharsets.ISO_8859_1)) { BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[1]), StandardCharsets.UTF_8)) {
String chartTitle = modelReader.readLine(); // first line is chart title String chartTitle = modelReader.readLine(); // first line is chart title
String[] series = modelReader.readLine().split(","); String[] series = modelReader.readLine().split(",");

View File

@ -67,7 +67,7 @@ public final class ChartFromScratch {
return; return;
} }
try (BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[0]), StandardCharsets.ISO_8859_1)) { try (BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[0]), StandardCharsets.UTF_8)) {
String chartTitle = modelReader.readLine(); // first line is chart title String chartTitle = modelReader.readLine(); // first line is chart title
String[] series = modelReader.readLine().split(","); String[] series = modelReader.readLine().split(",");

View File

@ -117,7 +117,7 @@ class TestXDDFChartRemoveSeries {
} }
/** /**
* Remove the first series by calling chartData.getSeries().remove(0). * Attempt to remove the first series by calling chartData.getSeries().remove(0).
* <p> * <p>
* This used to corrupt the workbook but the returned <code>List</code> is unmodifiable. * This used to corrupt the workbook but the returned <code>List</code> is unmodifiable.
*/ */
@ -171,4 +171,4 @@ class TestXDDFChartRemoveSeries {
assertEquals(2, chartData.getSeriesCount()); assertEquals(2, chartData.getSeriesCount());
} }
} }

View File

@ -67,8 +67,8 @@ class TestXSSFLineChartData {
XDDFChartData.Series series = lineChartData.addSeries(xs, ys); XDDFChartData.Series series = lineChartData.addSeries(xs, ys);
assertNotNull(series); assertNotNull(series);
assertEquals(1, lineChartData.getSeries().size()); assertEquals(1, lineChartData.getSeriesCount());
assertTrue(lineChartData.getSeries().contains(series)); assertTrue(lineChartData.getSeries(0) == series);
chart.plot(lineChartData); chart.plot(lineChartData);
wb.close(); wb.close();

View File

@ -70,8 +70,8 @@ public final class TestXSSFScatterChartData {
assertEquals(ScatterStyle.LINE_MARKER, scatterChartData.getStyle()); assertEquals(ScatterStyle.LINE_MARKER, scatterChartData.getStyle());
assertNotNull(series); assertNotNull(series);
assertEquals(1, scatterChartData.getSeries().size()); assertEquals(1, scatterChartData.getSeriesCount());
assertTrue(scatterChartData.getSeries().contains(series)); assertTrue(scatterChartData.getSeries(0) == series);
chart.plot(scatterChartData); chart.plot(scatterChartData);
wb.close(); wb.close();

View File

@ -56,7 +56,7 @@ class TestXWPFChart {
assertEquals(1, chart.getChartSeries().size()); assertEquals(1, chart.getChartSeries().size());
XDDFChartData data = chart.getChartSeries().get(0); XDDFChartData data = chart.getChartSeries().get(0);
assertEquals(XDDFBarChartData.class, data.getClass()); assertEquals(XDDFBarChartData.class, data.getClass());
assertEquals(3, data.getSeries().size()); assertEquals(3, data.getSeriesCount());
} }
/** /**