From 64d9a97d44fbc11da9e2b06058fdc0e1dca26b37 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Fri, 15 Jul 2022 22:52:45 +0000 Subject: [PATCH] [github-349] tidy up some test assertions. Thanks to XenoAmess. This closes #349 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1902757 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xssf/usermodel/charts/TestXSSFLineChartData.java | 6 +++--- .../poi/xssf/usermodel/charts/TestXSSFScatterChartData.java | 6 +++--- .../org/apache/poi/xwpf/usermodel/TestXWPFComments.java | 2 +- .../org/apache/poi/ss/usermodel/BaseTestRangeCopier.java | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/charts/TestXSSFLineChartData.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/charts/TestXSSFLineChartData.java index 71ff251ede..4999ce40cd 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/charts/TestXSSFLineChartData.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/charts/TestXSSFLineChartData.java @@ -18,7 +18,7 @@ package org.apache.poi.xssf.usermodel.charts; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertSame; import java.io.IOException; @@ -50,7 +50,7 @@ class TestXSSFLineChartData { }; @Test - void testOneSeriePlot() throws IOException { + void testOneSeriesPlot() throws IOException { XSSFWorkbook wb = new XSSFWorkbook(); XSSFSheet sheet = (XSSFSheet) new SheetBuilder(wb, plotData).build(); XSSFDrawing drawing = sheet.createDrawingPatriarch(); @@ -68,7 +68,7 @@ class TestXSSFLineChartData { assertNotNull(series); assertEquals(1, lineChartData.getSeriesCount()); - assertTrue(lineChartData.getSeries(0) == series); + assertSame(series, lineChartData.getSeries(0)); chart.plot(lineChartData); wb.close(); diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/charts/TestXSSFScatterChartData.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/charts/TestXSSFScatterChartData.java index c6ce428fd6..8fe55e55c8 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/charts/TestXSSFScatterChartData.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/charts/TestXSSFScatterChartData.java @@ -19,7 +19,7 @@ package org.apache.poi.xssf.usermodel.charts; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertSame; import java.io.IOException; @@ -52,7 +52,7 @@ public final class TestXSSFScatterChartData { }; @Test - void testOneSeriePlot() throws IOException { + void testOneSeriesPlot() throws IOException { XSSFWorkbook wb = new XSSFWorkbook(); XSSFSheet sheet = (XSSFSheet) new SheetBuilder(wb, plotData).build(); XSSFDrawing drawing = sheet.createDrawingPatriarch(); @@ -71,7 +71,7 @@ public final class TestXSSFScatterChartData { assertEquals(ScatterStyle.LINE_MARKER, scatterChartData.getStyle()); assertNotNull(series); assertEquals(1, scatterChartData.getSeriesCount()); - assertTrue(scatterChartData.getSeries(0) == series); + assertSame(series, scatterChartData.getSeries(0)); chart.plot(scatterChartData); wb.close(); diff --git a/poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFComments.java b/poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFComments.java index cefbab0ef4..ea2818c9a3 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFComments.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFComments.java @@ -55,7 +55,7 @@ class TestXWPFComments { assertNotNull(docIn.getDocComments()); assertEquals(1, docIn.getComments().length); comment = docIn.getCommentByID("0"); - assertTrue(null != comment); + assertNotNull(comment); assertEquals("Author", comment.getAuthor()); } } diff --git a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestRangeCopier.java b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestRangeCopier.java index 6610623545..6239eb22b5 100644 --- a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestRangeCopier.java +++ b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestRangeCopier.java @@ -153,7 +153,7 @@ public abstract class BaseTestRangeCopier { assertEquals(cellContent, getCellContent(destSheet, "D6")); assertFalse(destSheet.getMergedRegions().isEmpty()); destSheet.getMergedRegions().forEach((mergedRegion) -> { - assertTrue(mergedRegion.equals(mergedRangeAddress)); + assertEquals(mergedRangeAddress, mergedRegion); }); } -- 2.39.5