]> source.dussan.org Git - poi.git/commitdiff
Let IntelliJ simplify some assertions
authorDominik Stadler <centic@apache.org>
Sun, 15 Dec 2019 14:53:46 +0000 (14:53 +0000)
committerDominik Stadler <centic@apache.org>
Sun, 15 Dec 2019 14:53:46 +0000 (14:53 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1871591 13f79535-47bb-0310-9956-ffa450edef68

107 files changed:
src/java/org/apache/poi/ss/format/CellNumberFormatter.java
src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackagingURIHelper.java
src/ooxml/testcases/org/apache/poi/xdgf/usermodel/section/CombinedIteratorTest.java
src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java
src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFChart.java
src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java
src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java
src/ooxml/testcases/org/apache/poi/xssf/extractor/TestXSSFImportFromXML.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/BaseTestXSSFPivotTable.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFColGrouping.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFComment.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataValidation.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDrawing.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFont.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFPicture.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFChartTitle.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFManualLayout.java
src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFEndnote.java
src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFFootnote.java
src/scratchpad/testcases/org/apache/poi/hmef/TestHMEFMessage.java
src/scratchpad/testcases/org/apache/poi/hpbf/TestHPBFDocument.java
src/scratchpad/testcases/org/apache/poi/hslf/model/TestHeadersFooters.java
src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocumentAtom.java
src/scratchpad/testcases/org/apache/poi/hslf/record/TestNotesAtom.java
src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlideAtom.java
src/scratchpad/testcases/org/apache/poi/hslf/record/TestSlidePersistAtom.java
src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java
src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNumberedList.java
src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNumberedList2.java
src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNumberedList3.java
src/scratchpad/testcases/org/apache/poi/hsmf/datatypes/TestMAPIProperty.java
src/scratchpad/testcases/org/apache/poi/hwpf/model/PlfLfoTest.java
src/scratchpad/testcases/org/apache/poi/hwpf/model/TestCHPBinTable.java
src/scratchpad/testcases/org/apache/poi/hwpf/model/TestFontTable.java
src/scratchpad/testcases/org/apache/poi/hwpf/model/TestPAPBinTable.java
src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestPictures.java
src/testcases/org/apache/poi/hpsf/basic/TestClassID.java
src/testcases/org/apache/poi/hssf/eventmodel/TestAbortableListener.java
src/testcases/org/apache/poi/hssf/eventmodel/TestEventRecordFactory.java
src/testcases/org/apache/poi/hssf/model/TestDrawingAggregate.java
src/testcases/org/apache/poi/hssf/model/TestEscherRecordFactory.java
src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java
src/testcases/org/apache/poi/hssf/model/TestFormulaParserEval.java
src/testcases/org/apache/poi/hssf/model/TestFormulaParserIf.java
src/testcases/org/apache/poi/hssf/model/TestHSSFAnchor.java
src/testcases/org/apache/poi/hssf/model/TestLinkTable.java
src/testcases/org/apache/poi/hssf/model/TestSheet.java
src/testcases/org/apache/poi/hssf/model/TestWorkbook.java
src/testcases/org/apache/poi/hssf/record/TestBoolErrRecord.java
src/testcases/org/apache/poi/hssf/record/TestCFHeaderRecord.java
src/testcases/org/apache/poi/hssf/record/TestColumnInfoRecord.java
src/testcases/org/apache/poi/hssf/record/TestCommonObjectDataSubRecord.java
src/testcases/org/apache/poi/hssf/record/TestDConRefRecord.java
src/testcases/org/apache/poi/hssf/record/TestExtSSTRecord.java
src/testcases/org/apache/poi/hssf/record/TestFormulaRecord.java
src/testcases/org/apache/poi/hssf/record/TestMergeCellsRecord.java
src/testcases/org/apache/poi/hssf/record/TestSSTRecord.java
src/testcases/org/apache/poi/hssf/record/aggregates/TestRowRecordsAggregate.java
src/testcases/org/apache/poi/hssf/record/chart/TestAreaFormatRecord.java
src/testcases/org/apache/poi/hssf/record/chart/TestAreaRecord.java
src/testcases/org/apache/poi/hssf/record/chart/TestAxisOptionsRecord.java
src/testcases/org/apache/poi/hssf/record/chart/TestBarRecord.java
src/testcases/org/apache/poi/hssf/record/chart/TestCategorySeriesAxisRecord.java
src/testcases/org/apache/poi/hssf/record/chart/TestDatRecord.java
src/testcases/org/apache/poi/hssf/record/chart/TestDataFormatRecord.java
src/testcases/org/apache/poi/hssf/record/chart/TestFrameRecord.java
src/testcases/org/apache/poi/hssf/record/chart/TestLegendRecord.java
src/testcases/org/apache/poi/hssf/record/chart/TestLineFormatRecord.java
src/testcases/org/apache/poi/hssf/record/chart/TestLinkedDataRecord.java
src/testcases/org/apache/poi/hssf/record/chart/TestSeriesLabelsRecord.java
src/testcases/org/apache/poi/hssf/record/chart/TestSheetPropertiesRecord.java
src/testcases/org/apache/poi/hssf/record/chart/TestTextRecord.java
src/testcases/org/apache/poi/hssf/record/chart/TestTickRecord.java
src/testcases/org/apache/poi/hssf/record/chart/TestValueRangeRecord.java
src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java
src/testcases/org/apache/poi/hssf/usermodel/TestDataValidation.java
src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java
src/testcases/org/apache/poi/hssf/usermodel/TestFormulaEvaluatorBugs.java
src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java
src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java
src/testcases/org/apache/poi/hssf/usermodel/TestHSSFComment.java
src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java
src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java
src/testcases/org/apache/poi/poifs/eventfilesystem/TestPOIFSReaderRegistry.java
src/testcases/org/apache/poi/poifs/filesystem/TestDirectoryNode.java
src/testcases/org/apache/poi/poifs/filesystem/TestDocumentDescriptor.java
src/testcases/org/apache/poi/poifs/filesystem/TestFilteringDirectoryNode.java
src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSDocumentPath.java
src/testcases/org/apache/poi/poifs/property/TestDirectoryProperty.java
src/testcases/org/apache/poi/poifs/property/TestDocumentProperty.java
src/testcases/org/apache/poi/poifs/property/TestRootProperty.java
src/testcases/org/apache/poi/sl/draw/geom/TestPresetGeometries.java
src/testcases/org/apache/poi/ss/formula/BaseTestExternalFunctions.java
src/testcases/org/apache/poi/ss/formula/TestPlainCellCache.java
src/testcases/org/apache/poi/ss/formula/eval/BaseTestCircularReferences.java
src/testcases/org/apache/poi/ss/formula/eval/TestFormulaBugs.java
src/testcases/org/apache/poi/ss/formula/functions/TestIsBlank.java
src/testcases/org/apache/poi/ss/formula/functions/TestTFunc.java
src/testcases/org/apache/poi/ss/usermodel/BaseTestCellComment.java
src/testcases/org/apache/poi/ss/usermodel/BaseTestColumnShifting.java
src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
src/testcases/org/apache/poi/ss/usermodel/BaseTestFont.java
src/testcases/org/apache/poi/ss/util/TestNumberComparer.java
src/testcases/org/apache/poi/util/TestBitField.java
src/testcases/org/apache/poi/util/TestIntList.java
src/testcases/org/apache/poi/util/TestTempFile.java

index 7a3070a542db04f091ff9f22213a4b8166abf580..a7e7666758ec306c9a5a2ce2c5435f82bcd034dd 100644 (file)
@@ -232,7 +232,7 @@ public class CellNumberFormatter extends CellFormatter {
         integerSpecials.addAll(specials.subList(0, integerEnd()));
 
         if (exponent == null) {
-            StringBuffer fmtBuf = new StringBuffer("%");
+            StringBuilder fmtBuf = new StringBuilder("%");
 
             int integerPartWidth = calculateIntegerPartWidth();
             int totalWidth = integerPartWidth + fractionPartWidth;
@@ -789,12 +789,11 @@ public class CellNumberFormatter extends CellFormatter {
             digit++;
             --pos;
         }
-        StringBuffer extraLeadingDigits = new StringBuffer();
         if (pos >= 0) {
             // We ran out of places to put digits before we ran out of digits; put this aside so we can add it later
             // pos was decremented at the end of the loop above when the iterator was at its end
             ++pos;
-            extraLeadingDigits = new StringBuffer(result.substring(0, pos));
+            StringBuffer extraLeadingDigits = new StringBuffer(result.substring(0, pos));
             if (showGroupingSeparator) {
                 while (pos > 0) {
                     if (digit > 0 && digit % 3 == 0) {
index 9e1f00ead68c779a2c98c358d6e85e69e5124c11..08081e711b8aac50f6698e31e21cc0919a0182a8 100644 (file)
@@ -85,9 +85,8 @@ public class TestPackagingURIHelper extends TestCase {
         // Relative part name
         PackagePartName relativeName = PackagingURIHelper.createPartName(
                 "media/image1.gif", partBase);
-        assertTrue("The part name must be equal to "
-                + partNameToValid.getName(), partNameToValid
-                .equals(relativeName));
+        assertEquals("The part name must be equal to "
+                + partNameToValid.getName(), partNameToValid, relativeName);
         pkg.revert();
     }
 
@@ -106,9 +105,8 @@ public class TestPackagingURIHelper extends TestCase {
         // Relative part name
         PackagePartName relativeName = PackagingURIHelper.createPartName(
                 new URI("media/image1.gif"), partBase);
-        assertTrue("The part name must be equal to "
-                + partNameToValid.getName(), partNameToValid
-                .equals(relativeName));
+        assertEquals("The part name must be equal to "
+                + partNameToValid.getName(), partNameToValid, relativeName);
         pkg.revert();
     }
 
index 47d71ff613086a39a0b60d8bc846b5ef223d569e..2b517448d66ebe33feba7333fef37961ae9545c0 100644 (file)
@@ -31,11 +31,11 @@ public class CombinedIteratorTest {
         Iterator<String> iter = iterable.iterator();
 
         for (String element : expected) {
-            Assert.assertEquals(true, iter.hasNext());
+            Assert.assertTrue(iter.hasNext());
             Assert.assertEquals(element, iter.next());
         }
 
-        Assert.assertEquals(false, iter.hasNext());
+        Assert.assertFalse(iter.hasNext());
     }
 
     @Test
index 7e7d708ced611702b2cfedc7a397e35ebda445ff..9c83ae925300e7bd878f3360ed6fdebdab55ba88 100644 (file)
@@ -265,13 +265,13 @@ public class TestXSLFAutoShape {
         assertFalse(rPr.isSetB());
         r.setBold(true);
         assertTrue(r.isBold());
-        assertEquals(true, rPr.getB());
+        assertTrue(rPr.getB());
 
         assertFalse(r.isItalic());
         assertFalse(rPr.isSetI());
         r.setItalic(true);
         assertTrue(r.isItalic());
-        assertEquals(true, rPr.getI());
+        assertTrue(rPr.getI());
 
         assertFalse(r.isUnderlined());
         assertFalse(rPr.isSetU());
index 412520aede7bc0af5e8c1f522ea9c1420da1c7d3..493a0b89df49d88f623926b7c4d08cb66f098441 100644 (file)
@@ -21,6 +21,8 @@ package org.apache.poi.xslf.usermodel;
 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.assertSame;
 import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
@@ -188,7 +190,7 @@ public class TestXSLFChart {
         XDDFChartData firstSeries = data.get(0);
                assertNotNull(firstSeries);
                if (firstSeries instanceof XDDFScatterChartData) {
-            assertEquals(null, firstSeries.getCategoryAxis());
+            assertNull(firstSeries.getCategoryAxis());
             assertEquals(2, firstSeries.getValueAxes().size());
             checkAxisOperations(firstSeries.getValueAxes().get(0));
             checkAxisOperations(firstSeries.getValueAxes().get(1));
@@ -219,10 +221,10 @@ public class TestXSLFChart {
                 * According to interface, 0.0 should be returned for
                 * uninitialized double properties.
                 */
-               assertTrue(layout.getX() == 0.0);
-               assertTrue(layout.getY() == 0.0);
-               assertTrue(layout.getWidthRatio() == 0.0);
-               assertTrue(layout.getHeightRatio() == 0.0);
+        assertEquals(0.0, layout.getX(), 0.0);
+        assertEquals(0.0, layout.getY(), 0.0);
+        assertEquals(0.0, layout.getWidthRatio(), 0.0);
+        assertEquals(0.0, layout.getHeightRatio(), 0.0);
 
                final double newRatio = 1.1;
                final double newCoordinate = 0.3;
@@ -230,31 +232,31 @@ public class TestXSLFChart {
                final LayoutTarget nonDefaultTarget = LayoutTarget.OUTER;
 
                layout.setWidthRatio(newRatio);
-               assertTrue(layout.getWidthRatio() == newRatio);
+        assertEquals(layout.getWidthRatio(), newRatio, 0.0);
 
                layout.setHeightRatio(newRatio);
-               assertTrue(layout.getHeightRatio() == newRatio);
+        assertEquals(layout.getHeightRatio(), newRatio, 0.0);
 
                layout.setX(newCoordinate);
-               assertTrue(layout.getX() == newCoordinate);
+        assertEquals(layout.getX(), newCoordinate, 0.0);
 
                layout.setY(newCoordinate);
-               assertTrue(layout.getY() == newCoordinate);
+        assertEquals(layout.getY(), newCoordinate, 0.0);
 
                layout.setXMode(nonDefaultMode);
-               assertTrue(layout.getXMode() == nonDefaultMode);
+        assertSame(layout.getXMode(), nonDefaultMode);
 
                layout.setYMode(nonDefaultMode);
-               assertTrue(layout.getYMode() == nonDefaultMode);
+        assertSame(layout.getYMode(), nonDefaultMode);
 
                layout.setWidthMode(nonDefaultMode);
-               assertTrue(layout.getWidthMode() == nonDefaultMode);
+        assertSame(layout.getWidthMode(), nonDefaultMode);
 
                layout.setHeightMode(nonDefaultMode);
-               assertTrue(layout.getHeightMode() == nonDefaultMode);
+        assertSame(layout.getHeightMode(), nonDefaultMode);
 
                layout.setTarget(nonDefaultTarget);
-               assertTrue(layout.getTarget() == nonDefaultTarget);
+        assertSame(layout.getTarget(), nonDefaultTarget);
        }
 
        private void checkAxisOperations(XDDFValueAxis axis) {
index c80fafef186142930d0e98a0f826cd7a1e721728..315a8f561c149b69091505309f4fd22b91c88c43 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.poi.xslf.usermodel;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
@@ -177,8 +178,7 @@ public class TestXSLFPictureShape {
         XSLFTextBox tb1 = group.createTextBox();
         XSLFTextBox tb2 = group.createTextBox();
 
-        assertFalse("We should have different names now, but had: " + tb1.getShapeName() + " for both",
-                tb1.getShapeName().equals(tb2.getShapeName()));
+        assertNotEquals("We should have different names now, but had: " + tb1.getShapeName() + " for both", tb1.getShapeName(), tb2.getShapeName());
 
         XMLSlideShow pptCopy = new XMLSlideShow();
 
@@ -216,8 +216,7 @@ public class TestXSLFPictureShape {
     }
 
     private void differentShapeName(XSLFShape shape1, XSLFShape shape2) {
-        assertFalse("We should have different names now, but had: " + shape1.getShapeName() + " for both",
-                shape1.getShapeName().equals(shape2.getShapeName()));
+        assertNotEquals("We should have different names now, but had: " + shape1.getShapeName() + " for both", shape1.getShapeName(), shape2.getShapeName());
     }
 
     @Test
index ba26fb8e95572bd8ac36a7251ef924a17022379c..2cb7c412ced1aea1acc775278748643cd3276f6f 100644 (file)
@@ -283,7 +283,7 @@ public class TestXSLFTextParagraph {
         p.setBulletFont("Calibri");
         assertEquals("Calibri", p.getBulletFont());
 
-        assertEquals(null, p.getBulletFontColor());
+        assertNull(p.getBulletFontColor());
         p.setBulletFontColor(Color.red);
         assertTrue(sameColor(Color.red, p.getBulletFontColor()));
 
index e93239d940ac5a90ba70b987dffb8655b3ed2354..6ba55c069206efe552f8e55c8e7e69155f690539 100644 (file)
@@ -75,14 +75,14 @@ public class TestXSSFImportFromXML {
             XSSFSheet sheet = wb.getSheetAt(0);
 
             XSSFRow row = sheet.getRow(0);
-            assertTrue(row.getCell(0).getStringCellValue().equals(name));
-            assertTrue(row.getCell(1).getStringCellValue().equals(teacher));
-            assertTrue(row.getCell(2).getStringCellValue().equals(tutor));
-            assertTrue(row.getCell(3).getStringCellValue().equals(cdl));
-            assertTrue(row.getCell(4).getStringCellValue().equals(duration));
-            assertTrue(row.getCell(5).getStringCellValue().equals(topic));
-            assertTrue(row.getCell(6).getStringCellValue().equals(project));
-            assertTrue(row.getCell(7).getStringCellValue().equals(credits));
+            assertEquals(row.getCell(0).getStringCellValue(), name);
+            assertEquals(row.getCell(1).getStringCellValue(), teacher);
+            assertEquals(row.getCell(2).getStringCellValue(), tutor);
+            assertEquals(row.getCell(3).getStringCellValue(), cdl);
+            assertEquals(row.getCell(4).getStringCellValue(), duration);
+            assertEquals(row.getCell(5).getStringCellValue(), topic);
+            assertEquals(row.getCell(6).getStringCellValue(), project);
+            assertEquals(row.getCell(7).getStringCellValue(), credits);
         }
     }
 
index fb83269f4a18c91646660fa5038a8650ec22d162..dcb793cf9f58e1dd5fd03357c894122f33adaaa4 100644 (file)
@@ -101,7 +101,7 @@ public abstract class BaseTestXSSFPivotTable {
         pivotTable.addColumnLabel(DataConsolidateFunction.SUM, columnIndex);
         CTPivotTableDefinition defintion = pivotTable.getCTPivotTableDefinition();
 
-        assertEquals(defintion.getColFields(), null);
+        assertNull(defintion.getColFields());
     }
 
     /**
index abd769aed716f5763a18ef05a9d1a570807edcdd..8d068ca678c5b971ddf317aa869c2335c1d3ab36 100644 (file)
@@ -18,6 +18,7 @@
 package org.apache.poi.xssf.usermodel;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
@@ -129,17 +130,17 @@ public class TestXSSFColGrouping {
         assertEquals(0, cols.getColArray(0).getOutlineLevel());
         assertEquals(2, cols.getColArray(0).getMin()); // 1 based
         assertEquals(2, cols.getColArray(0).getMax()); // 1 based
-        assertEquals(true, cols.getColArray(0).getCustomWidth());
+        assertTrue(cols.getColArray(0).getCustomWidth());
 
         assertEquals(1, cols.getColArray(1).getOutlineLevel());
         assertEquals(3, cols.getColArray(1).getMin()); // 1 based
         assertEquals(4, cols.getColArray(1).getMax()); // 1 based
-        assertEquals(true, cols.getColArray(1).getCustomWidth());
+        assertTrue(cols.getColArray(1).getCustomWidth());
 
         assertEquals(0, cols.getColArray(2).getOutlineLevel());
         assertEquals(5, cols.getColArray(2).getMin()); // 1 based
         assertEquals(5, cols.getColArray(2).getMax()); // 1 based
-        assertEquals(true, cols.getColArray(2).getCustomWidth());
+        assertTrue(cols.getColArray(2).getCustomWidth());
 
         assertEquals(3, cols.sizeOfColArray());
 
@@ -177,17 +178,17 @@ public class TestXSSFColGrouping {
         assertEquals(1, cols.getColArray(0).getOutlineLevel());
         assertEquals(2, cols.getColArray(0).getMin()); // 1 based
         assertEquals(2, cols.getColArray(0).getMax()); // 1 based
-        assertEquals(false, cols.getColArray(0).getCustomWidth());
+        assertFalse(cols.getColArray(0).getCustomWidth());
 
         assertEquals(1, cols.getColArray(1).getOutlineLevel());
         assertEquals(3, cols.getColArray(1).getMin()); // 1 based
         assertEquals(5, cols.getColArray(1).getMax()); // 1 based
-        assertEquals(true, cols.getColArray(1).getCustomWidth());
+        assertTrue(cols.getColArray(1).getCustomWidth());
 
         assertEquals(1, cols.getColArray(2).getOutlineLevel());
         assertEquals(6, cols.getColArray(2).getMin()); // 1 based
         assertEquals(6, cols.getColArray(2).getMax()); // 1 based
-        assertEquals(false, cols.getColArray(2).getCustomWidth());
+        assertFalse(cols.getColArray(2).getCustomWidth());
 
         assertEquals(3, cols.sizeOfColArray());
 
@@ -225,17 +226,17 @@ public class TestXSSFColGrouping {
         assertEquals(0, cols.getColArray(0).getOutlineLevel());
         assertEquals(3, cols.getColArray(0).getMin()); // 1 based
         assertEquals(3, cols.getColArray(0).getMax()); // 1 based
-        assertEquals(true, cols.getColArray(0).getCustomWidth());
+        assertTrue(cols.getColArray(0).getCustomWidth());
 
         assertEquals(1, cols.getColArray(1).getOutlineLevel());
         assertEquals(4, cols.getColArray(1).getMin()); // 1 based
         assertEquals(5, cols.getColArray(1).getMax()); // 1 based
-        assertEquals(true, cols.getColArray(1).getCustomWidth());
+        assertTrue(cols.getColArray(1).getCustomWidth());
 
         assertEquals(1, cols.getColArray(2).getOutlineLevel());
         assertEquals(6, cols.getColArray(2).getMin()); // 1 based
         assertEquals(6, cols.getColArray(2).getMax()); // 1 based
-        assertEquals(false, cols.getColArray(2).getCustomWidth());
+        assertFalse(cols.getColArray(2).getCustomWidth());
 
         assertEquals(3, cols.sizeOfColArray());
 
@@ -274,17 +275,17 @@ public class TestXSSFColGrouping {
         assertEquals(1, cols.getColArray(0).getOutlineLevel());
         assertEquals(2, cols.getColArray(0).getMin()); // 1 based
         assertEquals(2, cols.getColArray(0).getMax()); // 1 based
-        assertEquals(false, cols.getColArray(0).getCustomWidth());
+        assertFalse(cols.getColArray(0).getCustomWidth());
 
         assertEquals(1, cols.getColArray(1).getOutlineLevel());
         assertEquals(3, cols.getColArray(1).getMin()); // 1 based
         assertEquals(4, cols.getColArray(1).getMax()); // 1 based
-        assertEquals(true, cols.getColArray(1).getCustomWidth());
+        assertTrue(cols.getColArray(1).getCustomWidth());
 
         assertEquals(0, cols.getColArray(2).getOutlineLevel());
         assertEquals(5, cols.getColArray(2).getMin()); // 1 based
         assertEquals(5, cols.getColArray(2).getMax()); // 1 based
-        assertEquals(true, cols.getColArray(2).getCustomWidth());
+        assertTrue(cols.getColArray(2).getCustomWidth());
 
         assertEquals(3, cols.sizeOfColArray());
 
index d8d7554d4707694b1c2f6e8ee2c613f57bec7257..c11879b71bc4ca978de39444b17fd05e23773cb5 100644 (file)
@@ -19,9 +19,11 @@ package org.apache.poi.xssf.usermodel;
 
 import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_SPREADSHEETML;
 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.assertSame;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.io.FileOutputStream;
@@ -77,11 +79,11 @@ public final class TestXSSFComment extends BaseTestCellComment  {
         CTShape vmlShape = CTShape.Factory.newInstance();
 
         XSSFComment comment = new XSSFComment(sheetComments, ctComment, vmlShape);
-        assertEquals(null, comment.getString());
+        assertNull(comment.getString());
         assertEquals(0, comment.getRow());
         assertEquals(0, comment.getColumn());
         assertEquals("", comment.getAuthor());
-        assertEquals(false, comment.isVisible());
+        assertFalse(comment.isVisible());
     }
 
     @Test
@@ -168,7 +170,7 @@ public final class TestXSSFComment extends BaseTestCellComment  {
         assertSame(comment.getString(), richText);
         //check that the rich text is set in the comment
         CTRPrElt rPr = richText.getCTRst().getRArray(0).getRPr();
-        assertEquals(true, rPr.getIArray(0).getVal());
+        assertTrue(rPr.getIArray(0).getVal());
         assertEquals(8.5, rPr.getSzArray(0).getVal(), 0);
         assertEquals(IndexedColors.BLUE_GREY.getIndex(), rPr.getColorArray(0).getIndexed());
         assertEquals("Tahoma", rPr.getRFontArray(0).getVal());
index 0394f6fdd2557b3a204153720ba8e30a02d6e4e7..8a6e791b45396516c866b528fc9af24c40f07012 100644 (file)
@@ -17,6 +17,8 @@
 package org.apache.poi.xssf.usermodel;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 import java.math.BigDecimal;
@@ -323,7 +325,7 @@ public class TestXSSFDataValidation extends BaseTestDataValidation {
             sheet.addValidationData(validation);
 
             final List<XSSFDataValidation> dataValidations = sheet.getDataValidations();
-            assertEquals(true, dataValidations.get(0).getCtDdataValidation().getAllowBlank());
+            assertTrue(dataValidations.get(0).getCtDdataValidation().getAllowBlank());
         }
     }
 
@@ -338,7 +340,7 @@ public class TestXSSFDataValidation extends BaseTestDataValidation {
             sheet.addValidationData(validation);
 
             final List<XSSFDataValidation> dataValidations = sheet.getDataValidations();
-            assertEquals(false, dataValidations.get(0).getCtDdataValidation().getAllowBlank());
+            assertFalse(dataValidations.get(0).getCtDdataValidation().getAllowBlank());
         }
     }
 
@@ -353,7 +355,7 @@ public class TestXSSFDataValidation extends BaseTestDataValidation {
             sheet.addValidationData(validation);
 
             final List<XSSFDataValidation> dataValidations = sheet.getDataValidations();
-            assertEquals(true, dataValidations.get(0).getCtDdataValidation().getAllowBlank());
+            assertTrue(dataValidations.get(0).getCtDdataValidation().getAllowBlank());
         }
     }
 
index 714202e599b38b9a0bde2a6fa0dae91e4382ea2e..aacd1c18db0379ef3acb779978a189c14dd2f84b 100644 (file)
@@ -210,7 +210,7 @@ public class TestXSSFDrawing {
             XSSFShape sh1 = shapes1.get(i);
             XSSFShape sh2 = shapes2.get(i);
 
-            assertTrue(sh1.getClass() == sh2.getClass());
+            assertSame(sh1.getClass(), sh2.getClass());
             assertEquals(sh1.getShapeProperties().toString(), sh2.getShapeProperties().toString());
         }
 
@@ -246,8 +246,8 @@ public class TestXSSFDrawing {
         assertEquals(1, pr.sizeOfRArray());
 
         CTTextCharacterProperties rPr = pr.getRArray(0).getRPr();
-        assertEquals(true, rPr.getB());
-        assertEquals(true, rPr.getI());
+        assertTrue(rPr.getB());
+        assertTrue(rPr.getI());
         assertEquals(STTextUnderlineType.SNG, rPr.getU());
         assertArrayEquals(
                 new byte[]{0, (byte)128, (byte)128} ,
index f55621ccbd1a75573da75126fdc46e2cb80f152c..7186034e4b457e45a3ebd936e7bc241716d3cdf8 100644 (file)
@@ -72,12 +72,12 @@ public final class TestXSSFFont extends BaseTestFont{
                bool.setVal(false);
                ctFont.setBArray(0,bool);
                XSSFFont xssfFont=new XSSFFont(ctFont);
-               assertEquals(false, xssfFont.getBold());
+        assertFalse(xssfFont.getBold());
 
 
                xssfFont.setBold(true);
                assertEquals(ctFont.sizeOfBArray(),1);
-               assertEquals(true, ctFont.getBArray(0).getVal());
+        assertTrue(ctFont.getBArray(0).getVal());
        }
 
        @SuppressWarnings("deprecation")
@@ -105,7 +105,7 @@ public final class TestXSSFFont extends BaseTestFont{
         assertEquals(FontCharset.ARABIC.getValue(), xssfFont.getCharSet());
         
         // This one isn't allowed
-        assertEquals(null, FontCharset.valueOf(9999));
+        assertNull(FontCharset.valueOf(9999));
         try {
            xssfFont.setCharSet(9999);
            fail("Shouldn't be able to set an invalid charset");
@@ -153,12 +153,12 @@ public final class TestXSSFFont extends BaseTestFont{
                ctFont.setIArray(0,bool);
 
                XSSFFont xssfFont=new XSSFFont(ctFont);
-               assertEquals(false, xssfFont.getItalic());
+        assertFalse(xssfFont.getItalic());
 
                xssfFont.setItalic(true);
                assertEquals(ctFont.sizeOfIArray(),1);
-               assertEquals(true, ctFont.getIArray(0).getVal());
-               assertEquals(true,ctFont.getIArray(0).getVal());
+        assertTrue(ctFont.getIArray(0).getVal());
+        assertTrue(ctFont.getIArray(0).getVal());
        }
 
        @Test
@@ -169,12 +169,12 @@ public final class TestXSSFFont extends BaseTestFont{
                ctFont.setStrikeArray(0,bool);
 
                XSSFFont xssfFont=new XSSFFont(ctFont);
-               assertEquals(false, xssfFont.getStrikeout());
+        assertFalse(xssfFont.getStrikeout());
 
                xssfFont.setStrikeout(true);
                assertEquals(ctFont.sizeOfStrikeArray(),1);
-               assertEquals(true, ctFont.getStrikeArray(0).getVal());
-               assertEquals(true,ctFont.getStrikeArray(0).getVal());
+        assertTrue(ctFont.getStrikeArray(0).getVal());
+        assertTrue(ctFont.getStrikeArray(0).getVal());
        }
 
        @Test
@@ -399,11 +399,7 @@ public final class TestXSSFFont extends BaseTestFont{
                assertEquals(2, wb.getNumberOfFonts());
                assertEquals(nf, wb.getFontAt(1));
 
-               assertTrue(
-                               wb.getFontAt(0)
-                                               !=
-                                               wb.getFontAt(1)
-               );
+        assertNotSame(wb.getFontAt(0), wb.getFontAt(1));
 
                // Find it now
                assertNotNull(
index edaa974a2c0edcc05b153dab0059164585483213..885b3d55c73a6f15b6463a11f1f28c7c69deadc0 100644 (file)
@@ -75,7 +75,7 @@ public final class TestXSSFPicture extends BaseTestPicture {
         assertEquals(AnchorType.DONT_MOVE_AND_RESIZE, anchor.getAnchorType());
 
         XSSFPicture shape = drawing.createPicture(anchor, jpegIdx);
-        assertTrue(anchor.equals(shape.getAnchor()));
+        assertEquals(anchor, shape.getAnchor());
         assertNotNull(shape.getPictureData());
         assertArrayEquals(jpegData, shape.getPictureData().getData());
 
index 67da55b3a531a8fe94db5bdbaa0f4d08e9d265a8..a6e5ec4e2d5948b6cd47ee8def3b598c0a773e91 100644 (file)
@@ -48,6 +48,7 @@ import org.apache.poi.openxml4j.opc.OPCPackage;
 import org.apache.poi.openxml4j.opc.PackageAccess;
 import org.apache.poi.openxml4j.opc.PackagePart;
 import org.apache.poi.openxml4j.opc.PackagePartName;
+import org.apache.poi.openxml4j.opc.PackageRelationship;
 import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
 import org.apache.poi.openxml4j.opc.PackagingURIHelper;
 import org.apache.poi.openxml4j.opc.internal.FileHelper;
@@ -802,7 +803,7 @@ public final class TestXSSFWorkbook extends BaseTestXWorkbook {
         }
 
         try (XSSFWorkbook wb2 = (XSSFWorkbook) WorkbookFactory.create(file)) {
-            assertTrue(wb2.getPivotTables().size() == 1);
+            assertEquals(1, wb2.getPivotTables().size());
         }
 
         assertTrue(file.delete());
@@ -822,7 +823,7 @@ public final class TestXSSFWorkbook extends BaseTestXWorkbook {
 
         try (XSSFWorkbook wb2 = (XSSFWorkbook) WorkbookFactory.create(file)) {
             setPivotData(wb2);
-            assertTrue(wb2.getPivotTables().size() == 2);
+            assertEquals(2, wb2.getPivotTables().size());
         }
 
         assertTrue(file.delete());
@@ -890,7 +891,9 @@ public final class TestXSSFWorkbook extends BaseTestXWorkbook {
         assertTrue(wbPart.hasRelationships());
         final PackageRelationshipCollection relationships = wbPart.getRelationships().getRelationships(XSSFRelation.VBA_MACROS.getRelation());
         assertEquals(1, relationships.size());
-        assertEquals(XSSFRelation.VBA_MACROS.getDefaultFileName(), relationships.getRelationship(0).getTargetURI().toString());
+        PackageRelationship relationship = relationships.getRelationship(0);
+        assertNotNull(relationship);
+        assertEquals(XSSFRelation.VBA_MACROS.getDefaultFileName(), relationship.getTargetURI().toString());
         PackagePart vbaPart = pkg.getPart(PackagingURIHelper.createPartName(XSSFRelation.VBA_MACROS.getDefaultFileName()));
         assertNotNull(vbaPart);
         assertFalse(vbaPart.isRelationshipPart());
@@ -984,6 +987,7 @@ public final class TestXSSFWorkbook extends BaseTestXWorkbook {
         wb.close();
     }
 
+    @SuppressWarnings("deprecation")
     @Test
     public void testBug56957CloseWorkbook() throws Exception {
         File file = TempFile.createTempFile("TestBug56957_", ".xlsx");
@@ -1027,7 +1031,7 @@ public final class TestXSSFWorkbook extends BaseTestXWorkbook {
     }
 
     @Test
-    public void closeDoesNotModifyWorkbook() throws IOException, InvalidFormatException {
+    public void closeDoesNotModifyWorkbook() throws IOException {
         final String filename = "SampleSS.xlsx";
         final File file = POIDataSamples.getSpreadSheetInstance().getFile(filename);
         Workbook wb;
@@ -1146,7 +1150,6 @@ public final class TestXSSFWorkbook extends BaseTestXWorkbook {
 
     /**
      * See bug #61700
-     * @throws Exception
      */
     @Test
     public void testWorkbookForceFormulaRecalculation() throws Exception {
index f85f44d22ae05c8521693bddc0998bd61d9d5004..d0388175e105a599e994770bd893357427d08f58 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.poi.xssf.usermodel.charts;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
@@ -139,7 +140,7 @@ public class TestXSSFChartTitle {
         XSSFRichTextString originalTitle = chart.getTitleText();
         assertNotNull(originalTitle);
         final String myTitle = "My chart title";
-        assertFalse(myTitle.equals(originalTitle.toString()));
+        assertNotEquals(myTitle, originalTitle.toString());
         chart.setTitleText(myTitle);
         XSSFRichTextString queryTitle = chart.getTitleText();
         assertNotNull(queryTitle);
index 85ac30f30ff4c800252eb49b983527f215c3546b..6cfe2f14a074c8c60a0dc885cb9efa93fcdf99ea 100644 (file)
@@ -17,7 +17,9 @@
 
 package org.apache.poi.xssf.usermodel.charts;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
@@ -68,31 +70,31 @@ public final class TestXSSFManualLayout {
                final LayoutTarget nonDefaultTarget = LayoutTarget.OUTER;
 
                layout.setWidthRatio(newRatio);
-               assertTrue(layout.getWidthRatio() == newRatio);
+        assertEquals(layout.getWidthRatio(), newRatio, 0.0);
 
                layout.setHeightRatio(newRatio);
-               assertTrue(layout.getHeightRatio() == newRatio);
+        assertEquals(layout.getHeightRatio(), newRatio, 0.0);
 
                layout.setX(newCoordinate);
-               assertTrue(layout.getX() == newCoordinate);
+        assertEquals(layout.getX(), newCoordinate, 0.0);
 
                layout.setY(newCoordinate);
-               assertTrue(layout.getY() == newCoordinate);
+        assertEquals(layout.getY(), newCoordinate, 0.0);
 
                layout.setXMode(nonDefaultMode);
-               assertTrue(layout.getXMode() == nonDefaultMode);
+        assertSame(layout.getXMode(), nonDefaultMode);
 
                layout.setYMode(nonDefaultMode);
-               assertTrue(layout.getYMode() == nonDefaultMode);
+        assertSame(layout.getYMode(), nonDefaultMode);
 
                layout.setWidthMode(nonDefaultMode);
-               assertTrue(layout.getWidthMode() == nonDefaultMode);
+        assertSame(layout.getWidthMode(), nonDefaultMode);
 
                layout.setHeightMode(nonDefaultMode);
-               assertTrue(layout.getHeightMode() == nonDefaultMode);
+        assertSame(layout.getHeightMode(), nonDefaultMode);
 
                layout.setTarget(nonDefaultTarget);
-               assertTrue(layout.getTarget() == nonDefaultTarget);
+        assertSame(layout.getTarget(), nonDefaultTarget);
 
        }
 
@@ -111,9 +113,9 @@ public final class TestXSSFManualLayout {
                 * According to interface, 0.0 should be returned for
                 * uninitialized double properties.
                 */
-               assertTrue(layout.getX() == 0.0);
-               assertTrue(layout.getY() == 0.0);
-               assertTrue(layout.getWidthRatio() == 0.0);
-               assertTrue(layout.getHeightRatio() == 0.0);
+        assertEquals(0.0, layout.getX(), 0.0);
+        assertEquals(0.0, layout.getY(), 0.0);
+        assertEquals(0.0, layout.getWidthRatio(), 0.0);
+        assertEquals(0.0, layout.getHeightRatio(), 0.0);
        }
 }
index 0bc0fed7368d8890cc4b3eaf5a968f572072b3d1..addfbcb6a913f0f18c1a9cb53bbae25ee5493f25 100644 (file)
@@ -94,7 +94,7 @@ public class TestXWPFEndnote {
 
         XWPFRun r2 = testP2.getRuns().get(0);
         assertNotNull("Expected a run in testP2", r2);
-        assertTrue("Found an endnote reference in testP2", r2.getCTR().getEndnoteRefList().size() == 0);
+        assertEquals("Found an endnote reference in testP2", 0, r2.getCTR().getEndnoteRefList().size());
         
     }
     
index b875644cb54c40e2f9b00f80f76d42654b61f55f..143a3ad2adf2cca5be60163f668ca165e3d929e9 100644 (file)
@@ -94,7 +94,7 @@ public class TestXWPFFootnote {
 
         XWPFRun r2 = testP2.getRuns().get(0);
         assertNotNull("Expected a run in testP2", r2);
-        assertTrue("Found a footnote reference in testP2", r2.getCTR().getFootnoteRefList().size() == 0);
+        assertEquals("Found a footnote reference in testP2", 0, r2.getCTR().getFootnoteRefList().size());
         
     }
     
index 1bf0fa117b4cd0861a7f9b9caaa992cd6aa17f2e..903742c6c8ed69f3da7792461db8279c310a0831 100644 (file)
@@ -236,8 +236,8 @@ public final class TestHMEFMessage {
             if (attr.getProperty().id == 0xe28) hasE28 = true;
             if (attr.getProperty().id == 0xe29) hasE29 = true;
         }
-        assertEquals(true, hasE28);
-        assertEquals(true, hasE29);
+       assertTrue(hasE28);
+       assertTrue(hasE29);
 
         // Ensure we can fetch those as custom ones
         MAPIProperty propE28 = MAPIProperty.createCustom(0xe28, Types.ASCII_STRING, "Custom E28");
index ff290d711d93c96db819497a196b1971fee9c8a9..acb5a740f77c675c8638429fdb8ac6152c6b722c 100644 (file)
@@ -17,6 +17,7 @@
 
 package org.apache.poi.hpbf;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
@@ -52,7 +53,7 @@ public final class TestHPBFDocument {
                assertTrue(doc.getMainContents().getData().length > 0);
                assertTrue(doc.getQuillContents().getData().length > 0);
                assertTrue(doc.getEscherStm().getData().length > 0);
-               assertTrue(doc.getEscherDelayStm().getData().length == 0);
+        assertEquals(0, doc.getEscherDelayStm().getData().length);
 
        doc.close();
        }
index 66795b5f1a5644b2df0b42608de5d75d44d429ee..f51930ed54afc0dd25aff3f60fbb1940f013ac8a 100644 (file)
@@ -83,9 +83,9 @@ public final class TestHeadersFooters
 
         //the first slide uses per-slide headers / footers
         HeadersFooters hd2 = slide.get(1).getHeadersFooters();
-        assertEquals(true, hd2.isFooterVisible());
+        assertTrue(hd2.isFooterVisible());
         assertEquals("per-slide footer", hd2.getFooterText());
-        assertEquals(true, hd2.isUserDateVisible());
+        assertTrue(hd2.isUserDateVisible());
         assertEquals("custom date format", hd2.getDateTimeText());
 
         ppt.close();
index 40f4cd787fe1c5ed15df5e59523afe5c1e4d2f12..82ec7bec513a0dc9cebc3daba55e2379b481cc47 100644 (file)
@@ -60,10 +60,10 @@ public final class TestDocumentAtom extends TestCase {
        }
        public void testBooleans() {
                DocumentAtom da = new DocumentAtom(data_a, 0, data_a.length);
-               assertEquals(false, da.getSaveWithFonts());
-               assertEquals(false, da.getOmitTitlePlace());
-               assertEquals(false, da.getRightToLeft());
-               assertEquals(true, da.getShowComments());
+        assertFalse(da.getSaveWithFonts());
+        assertFalse(da.getOmitTitlePlace());
+        assertFalse(da.getRightToLeft());
+        assertTrue(da.getShowComments());
        }
 
        public void testWrite() throws Exception {
index fc207ea3cacd48903603ed9bd52dd827827e144f..796fb6eb2c719679fb44fd428c1bc62247ccebbd 100644 (file)
@@ -38,9 +38,9 @@ public final class TestNotesAtom extends TestCase {
        public void testFlags() {
                NotesAtom na = new NotesAtom(data_a, 0, data_a.length);
                assertEquals(0x80000000, na.getSlideID());
-               assertEquals(false, na.getFollowMasterObjects());
-               assertEquals(false, na.getFollowMasterScheme());
-               assertEquals(false, na.getFollowMasterBackground());
+        assertFalse(na.getFollowMasterObjects());
+        assertFalse(na.getFollowMasterScheme());
+        assertFalse(na.getFollowMasterBackground());
        }
 
        public void testWrite() throws Exception {
index 3e2fc49b1420e7dedd92d837578a0edea5a08c1a..7915346673478b7fd7f39afa5fd3a56249eb01ab 100644 (file)
@@ -57,9 +57,9 @@ public final class TestSlideAtom {
                assertEquals(256, sa.getNotesID());
 
                // Check the flags
-               assertEquals(true, sa.getFollowMasterObjects());
-               assertEquals(true, sa.getFollowMasterScheme());
-               assertEquals(true, sa.getFollowMasterBackground());
+        assertTrue(sa.getFollowMasterObjects());
+        assertTrue(sa.getFollowMasterScheme());
+        assertTrue(sa.getFollowMasterBackground());
        }
 
     @Test
index 87d8a17502d0c9afc4b4ea30a7525b28de62df1d..19d99c45693abca36c98ca74e8db1334d78354f5 100644 (file)
@@ -39,7 +39,7 @@ public final class TestSlidePersistAtom extends TestCase {
        public void testFlags() {
                SlidePersistAtom spa = new SlidePersistAtom(data_a, 0, data_a.length);
                assertEquals(4, spa.getRefID() );
-               assertEquals(true, spa.getHasShapesOtherThanPlaceholders() );
+        assertTrue(spa.getHasShapesOtherThanPlaceholders());
                assertEquals(2, spa.getNumPlaceholderTexts() );
                assertEquals(256, spa.getSlideIdentifier());
        }
index 0927d37edd396945f8d2c1d4e60a7a5022911d35..f9290e18fdecc0a1f81764d253998478d0063825 100644 (file)
@@ -226,7 +226,7 @@ public final class TestStyleTextPropAtom {
         assertEquals(2,b_ch_1.getTextPropList().size());
         TextProp tp_1_1 = b_ch_1.getTextPropList().get(0);
         TextProp tp_1_2 = b_ch_1.getTextPropList().get(1);
-        assertEquals(true, tp_1_1 instanceof CharFlagsTextProp);
+        assertTrue(tp_1_1 instanceof CharFlagsTextProp);
         assertEquals("font.size", tp_1_2.getName());
         assertEquals(20, tp_1_2.getValue());
 
@@ -235,7 +235,7 @@ public final class TestStyleTextPropAtom {
         TextProp tp_2_1 = b_ch_2.getTextPropList().get(0);
         TextProp tp_2_2 = b_ch_2.getTextPropList().get(1);
         TextProp tp_2_3 = b_ch_2.getTextPropList().get(2);
-        assertEquals(true, tp_2_1 instanceof CharFlagsTextProp);
+        assertTrue(tp_2_1 instanceof CharFlagsTextProp);
         assertEquals("font.size", tp_2_2.getName());
         assertEquals("font.color", tp_2_3.getName());
         assertEquals(20, tp_2_2.getValue());
@@ -253,7 +253,7 @@ public final class TestStyleTextPropAtom {
         TextProp tp_4_1 = b_ch_4.getTextPropList().get(0);
         TextProp tp_4_2 = b_ch_4.getTextPropList().get(1);
         TextProp tp_4_3 = b_ch_4.getTextPropList().get(2);
-        assertEquals(true, tp_4_1 instanceof CharFlagsTextProp);
+        assertTrue(tp_4_1 instanceof CharFlagsTextProp);
         assertEquals("font.index", tp_4_2.getName());
         assertEquals("font.size", tp_4_3.getName());
         assertEquals(24, tp_4_3.getValue());
@@ -317,42 +317,42 @@ public final class TestStyleTextPropAtom {
 
         // 1st is bold
         CharFlagsTextProp cf_1_1 = (CharFlagsTextProp)b_ch_1.getTextPropList().get(0);
-        assertEquals(true,cf_1_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
-        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
-        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
-        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
-        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
-        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
-        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
-        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
-        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
+        assertTrue(cf_1_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
+        assertFalse(cf_1_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
+        assertFalse(cf_1_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
+        assertFalse(cf_1_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
+        assertFalse(cf_1_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
+        assertFalse(cf_1_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
+        assertFalse(cf_1_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
+        assertFalse(cf_1_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
+        assertFalse(cf_1_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
 
         // 2nd is italic
         CharFlagsTextProp cf_2_1 = (CharFlagsTextProp)b_ch_2.getTextPropList().get(0);
-        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
-        assertEquals(true,cf_2_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
-        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
-        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
-        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
-        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
-        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
-        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
-        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
+        assertFalse(cf_2_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
+        assertTrue(cf_2_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
+        assertFalse(cf_2_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
+        assertFalse(cf_2_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
+        assertFalse(cf_2_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
+        assertFalse(cf_2_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
+        assertFalse(cf_2_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
+        assertFalse(cf_2_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
+        assertFalse(cf_2_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
 
         // 3rd is normal, so lacks a CharFlagsTextProp
         assertFalse(b_ch_3.getTextPropList().get(0) instanceof CharFlagsTextProp);
 
         // 4th is underlined
         CharFlagsTextProp cf_4_1 = (CharFlagsTextProp)b_ch_4.getTextPropList().get(0);
-        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
-        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
-        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
-        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
-        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
-        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
-        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
-        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
-        assertEquals(true,cf_4_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
+        assertFalse(cf_4_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
+        assertFalse(cf_4_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
+        assertFalse(cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
+        assertFalse(cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
+        assertFalse(cf_4_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
+        assertFalse(cf_4_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
+        assertFalse(cf_4_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
+        assertFalse(cf_4_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
+        assertTrue(cf_4_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
 
         // The value for this should be 4
         assertEquals(0x0004, cf_4_1.getValue());
@@ -362,15 +362,15 @@ public final class TestStyleTextPropAtom {
         cf_4_1.setSubValue(true, CharFlagsTextProp.ITALIC_IDX);
         cf_4_1.setSubValue(false, CharFlagsTextProp.UNDERLINE_IDX);
 
-        assertEquals(true,cf_4_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
-        assertEquals(true,cf_4_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
-        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
-        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
-        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
-        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
-        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
-        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
-        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
+        assertTrue(cf_4_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
+        assertTrue(cf_4_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
+        assertFalse(cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
+        assertFalse(cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
+        assertFalse(cf_4_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
+        assertFalse(cf_4_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
+        assertFalse(cf_4_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
+        assertFalse(cf_4_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
+        assertFalse(cf_4_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
 
         // The value should now be 3
         assertEquals(0x0003, cf_4_1.getValue());
index b21f216577ae69119d178471b42dc06ea513649e..31778e6ba306869db4643b9339fd7a587f0884a3 100644 (file)
@@ -58,12 +58,12 @@ public final class TestNumberedList {
                final TextPFException9[] autoNumbers = numberedListInfo.getAutoNumberTypes();
                assertNotNull(autoNumbers);
                assertEquals(4, autoNumbers.length);
-               assertTrue(4 == autoNumbers[0].getAutoNumberStartNumber());
+        assertEquals(4, (short) autoNumbers[0].getAutoNumberStartNumber());
                assertNull(autoNumbers[1].getAutoNumberStartNumber());
-               assertTrue(3 == autoNumbers[2].getAutoNumberStartNumber());
-               assertTrue(AutoNumberingScheme.arabicPeriod == autoNumbers[0].getAutoNumberScheme());
+        assertEquals(3, (short) autoNumbers[2].getAutoNumberStartNumber());
+        assertSame(AutoNumberingScheme.arabicPeriod, autoNumbers[0].getAutoNumberScheme());
                assertNull(autoNumbers[1].getAutoNumberScheme());
-               assertTrue(AutoNumberingScheme.alphaLcParenRight == autoNumbers[2].getAutoNumberScheme());
+        assertSame(AutoNumberingScheme.alphaLcParenRight, autoNumbers[2].getAutoNumberScheme());
                        
                List<List<HSLFTextParagraph>> textParass = s.getTextParagraphs();
                assertEquals(2, textParass.size());
@@ -100,12 +100,12 @@ public final class TestNumberedList {
                final TextPFException9[] autoNumbers = numberedListInfo.getAutoNumberTypes();
                assertNotNull(autoNumbers);
                assertEquals(4, autoNumbers.length);
-               assertTrue(9 == autoNumbers[0].getAutoNumberStartNumber());
+        assertEquals(9, (short) autoNumbers[0].getAutoNumberStartNumber());
                assertNull(autoNumbers[1].getAutoNumberStartNumber());
-               assertTrue(3 == autoNumbers[2].getAutoNumberStartNumber());
-               assertTrue(AutoNumberingScheme.arabicParenRight == autoNumbers[0].getAutoNumberScheme());
+        assertEquals(3, (short) autoNumbers[2].getAutoNumberStartNumber());
+        assertSame(AutoNumberingScheme.arabicParenRight, autoNumbers[0].getAutoNumberScheme());
                assertNull(autoNumbers[1].getAutoNumberScheme());
-               assertTrue(AutoNumberingScheme.alphaUcPeriod == autoNumbers[2].getAutoNumberScheme());
+        assertSame(AutoNumberingScheme.alphaUcPeriod, autoNumbers[2].getAutoNumberScheme());
 
                final List<List<HSLFTextParagraph>> textParass = s.getTextParagraphs();
                assertEquals(2, textParass.size());
index 32ac8f4172d7dcb44c2c45092acd1efd4f0143e2..2ec650ea0c66aa22a9864aa98f1ca104e3f8a1bb 100644 (file)
@@ -21,6 +21,7 @@ package org.apache.poi.hslf.usermodel;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
@@ -69,11 +70,11 @@ public final class TestNumberedList2 {
                final TextPFException9[] autoNumbersOfTextBox0 = numberedListInfoForTextBox0.getAutoNumberTypes();
                assertEquals(Short.valueOf((short)1), autoNumbersOfTextBox0[0].getfBulletHasAutoNumber());
                assertEquals(Short.valueOf((short)1), autoNumbersOfTextBox0[0].getAutoNumberStartNumber());//Default value = 1 will be used 
-               assertTrue(AutoNumberingScheme.arabicPeriod == autoNumbersOfTextBox0[0].getAutoNumberScheme());
+        assertSame(AutoNumberingScheme.arabicPeriod, autoNumbersOfTextBox0[0].getAutoNumberScheme());
                final TextPFException9[] autoNumbersOfTextBox1 = numberedListInfoForTextBox1.getAutoNumberTypes();
                assertEquals(Short.valueOf((short)1), autoNumbersOfTextBox1[0].getfBulletHasAutoNumber());
                assertEquals(Short.valueOf((short)6), autoNumbersOfTextBox1[0].getAutoNumberStartNumber());//Default value = 1 will be used 
-               assertTrue(AutoNumberingScheme.arabicPeriod == autoNumbersOfTextBox1[0].getAutoNumberScheme());
+        assertSame(AutoNumberingScheme.arabicPeriod, autoNumbersOfTextBox1[0].getAutoNumberScheme());
 
                
                List<List<HSLFTextParagraph>> textParass = s.getTextParagraphs();
@@ -105,7 +106,7 @@ public final class TestNumberedList2 {
                final TextPFException9[] autoNumbersOfTextBox = numberedListInfoForTextBox.getAutoNumberTypes();
                assertEquals(Short.valueOf((short)1), autoNumbersOfTextBox[0].getfBulletHasAutoNumber());
                assertEquals(Short.valueOf((short)1), autoNumbersOfTextBox[0].getAutoNumberStartNumber());//Default value = 1 will be used 
-               assertTrue(AutoNumberingScheme.arabicPeriod == autoNumbersOfTextBox[0].getAutoNumberScheme());
+        assertSame(AutoNumberingScheme.arabicPeriod, autoNumbersOfTextBox[0].getAutoNumberScheme());
                        
                List<List<HSLFTextParagraph>> textParass = s.getTextParagraphs();
                assertEquals(3, textParass.size());
index 36832c69e73c19a14604d24c400d4295f4c8286d..f3a682ffe5ce8317567455c5014d3c06c57bca93 100644 (file)
@@ -22,6 +22,7 @@ package org.apache.poi.hslf.usermodel;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
@@ -68,7 +69,7 @@ public final class TestNumberedList3 {
                final TextPFException9[] autoNumbersOfTextBox0 = numberedListInfoForTextBox.getAutoNumberTypes();
                assertEquals(Short.valueOf((short)1), autoNumbersOfTextBox0[0].getfBulletHasAutoNumber());
                assertEquals(Short.valueOf((short)1), autoNumbersOfTextBox0[0].getAutoNumberStartNumber());//Default value = 1 will be used 
-               assertTrue(AutoNumberingScheme.arabicPeriod == autoNumbersOfTextBox0[0].getAutoNumberScheme());
+        assertSame(AutoNumberingScheme.arabicPeriod, autoNumbersOfTextBox0[0].getAutoNumberScheme());
                
                final List<List<HSLFTextParagraph>> textParass = s.getTextParagraphs();
                assertEquals(3, textParass.size());
@@ -85,7 +86,7 @@ public final class TestNumberedList3 {
                assertEquals(1, autoNumbers.length);
                assertEquals(Short.valueOf((short)1), autoNumbers[0].getfBulletHasAutoNumber());
                assertEquals(Short.valueOf((short)1), autoNumbers[0].getAutoNumberStartNumber());//Default value = 1 will be used 
-               assertTrue(AutoNumberingScheme.arabicPeriod == autoNumbersOfTextBox0[0].getAutoNumberScheme());
+        assertSame(AutoNumberingScheme.arabicPeriod, autoNumbersOfTextBox0[0].getAutoNumberScheme());
                
                int chCovered = 0;
                for (HSLFTextParagraph htp : textParass.get(1)) {
index 55369e8dcda67bb0b2183cd36883ad00f5a0bd2f..d44980a9604301023263909544175c63985554b7 100644 (file)
@@ -33,14 +33,14 @@ public final class TestMAPIProperty extends TestCase {
    
    public void testGetAll() throws Exception {
       Collection<MAPIProperty> all = MAPIProperty.getAll();
-      assertEquals(true, all.contains(MAPIProperty.DISPLAY_NAME));
-      assertEquals(true, all.contains(MAPIProperty.DISPLAY_CC));
+       assertTrue(all.contains(MAPIProperty.DISPLAY_NAME));
+       assertTrue(all.contains(MAPIProperty.DISPLAY_CC));
       
       // Won't contain custom
-      assertEquals(false, all.contains(MAPIProperty.createCustom(1, Types.UNSPECIFIED, "")));
+       assertFalse(all.contains(MAPIProperty.createCustom(1, Types.UNSPECIFIED, "")));
       
       // Won't contain unknown
-      assertEquals(false, all.contains(MAPIProperty.UNKNOWN));
+       assertFalse(all.contains(MAPIProperty.UNKNOWN));
    }
    
    public void testCustom() throws Exception {
@@ -55,8 +55,8 @@ public final class TestMAPIProperty extends TestCase {
       
       // Won't be in all list
       Collection<MAPIProperty> all = MAPIProperty.getAll();
-      assertEquals(false, all.contains(c1));
-      assertEquals(false, all.contains(c2a));
-      assertEquals(false, all.contains(c2b));
+       assertFalse(all.contains(c1));
+       assertFalse(all.contains(c2a));
+       assertFalse(all.contains(c2b));
    }
 }
index b9dafae62a117522247dc9b9075846ab901d8f88..bde4c7659ee6af330aa8cc462feb3c4548f1824f 100644 (file)
@@ -40,17 +40,17 @@ public class PlfLfoTest {
         assertEquals(0, p.getLfoMac());
         assertEquals(0, p2.getLfoMac());
 
-        assertTrue(p.equals(p2));
+        assertEquals(p, p2);
         //noinspection ObjectEqualsNull
-        assertFalse(p.equals(null));
+        assertNotEquals(null, p);
 
         p.add(new LFO(new byte[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, 0), new LFOData());
         assertEquals(1, p.getLfoMac());
 
-        assertFalse(p.equals(p2));
+        assertNotEquals(p, p2);
 
         p2.add(new LFO(new byte[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, 0), new LFOData());
         assertEquals(1, p2.getLfoMac());
-        assertTrue(p.equals(p2));
+        assertEquals(p, p2);
     }
 }
\ No newline at end of file
index 96ca5cc64cd3336e977d9b8e8190e02e3cf3ffb9..b3aa64ab9c77b6e31f6609c7934527e6935b4332 100644 (file)
@@ -69,7 +69,7 @@ public final class TestCHPBinTable
     {
       CHPX oldNode = oldTextRuns.get(x);
       CHPX newNode = newTextRuns.get(x);
-      assertTrue(oldNode.equals(newNode));
+        assertEquals(oldNode, newNode);
     }
 
   }
index 860e568850077d5ba19c3c4bf5e81c8b78a72679..488e28f2d31fe0bff1c8c848aafff6ff79b5e24d 100644 (file)
@@ -17,6 +17,7 @@
 
 package org.apache.poi.hwpf.model;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 import java.io.ByteArrayOutputStream;
@@ -53,7 +54,7 @@ public final class TestFontTable {
 
     FontTable newFontTable = new FontTable(newTableStream, 0, newTableStream.length);
 
-         assertTrue(_fontTable.equals(newFontTable));
+      assertEquals(_fontTable, newFontTable);
 
   }
 
index 1befadb5f470959c0d1b2d82b76d01a11230a7ef..bf2a196dc027149a3f224d9b00d6f7662d4de195 100644 (file)
@@ -74,7 +74,7 @@ public final class TestPAPBinTable {
             PAPX oldNode = oldTextRuns.get( x );
             PAPX newNode = newTextRuns.get( x );
 
-            assertTrue( oldNode.equals( newNode ) );
+            assertEquals(oldNode, newNode);
         }
 
         _hWPFDocFixture.tearDown();
index fc6ac11bc13d5e683098a5b8db12ae8b818450e6..8c829c0fffa63339251e91665fcf45c0ed7a1702 100644 (file)
@@ -18,6 +18,7 @@
 package org.apache.poi.hwpf.usermodel;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
@@ -178,47 +179,47 @@ public final class TestPictures {
        p = r.getParagraph(0);
        assertEquals(2, p.numCharacterRuns());
        assertEquals("I have lots of embedded files in me\r", p.text());
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(0)));
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(1)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(0)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(1)));
        
        p = r.getParagraph(1);
        assertEquals(5, p.numCharacterRuns());
        assertEquals("\u0013 EMBED Excel.Sheet.8  \u0014\u0001\u0015\r", p.text());
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(0)));
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(1)));
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(2)));
-       assertEquals(true,  pictureTable.hasPicture(p.getCharacterRun(3)));
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(4)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(0)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(1)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(2)));
+        assertTrue(pictureTable.hasPicture(p.getCharacterRun(3)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(4)));
        
        p = r.getParagraph(2);
        assertEquals(6, p.numCharacterRuns());
        assertEquals("\u0013 EMBED Excel.Sheet.8  \u0014\u0001\u0015\r", p.text());
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(0)));
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(1)));
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(2)));
-       assertEquals(true,  pictureTable.hasPicture(p.getCharacterRun(3)));
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(4)));
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(5)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(0)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(1)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(2)));
+        assertTrue(pictureTable.hasPicture(p.getCharacterRun(3)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(4)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(5)));
        
        p = r.getParagraph(3);
        assertEquals(6, p.numCharacterRuns());
        assertEquals("\u0013 EMBED PowerPoint.Show.8  \u0014\u0001\u0015\r", p.text());
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(0)));
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(1)));
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(2)));
-       assertEquals(true,  pictureTable.hasPicture(p.getCharacterRun(3)));
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(4)));
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(5)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(0)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(1)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(2)));
+        assertTrue(pictureTable.hasPicture(p.getCharacterRun(3)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(4)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(5)));
        
        p = r.getParagraph(4);
        assertEquals(6, p.numCharacterRuns());
        assertEquals("\u0013 EMBED Word.Document.8 \\s \u0014\u0001\u0015\r", p.text());
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(0)));
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(1)));
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(2)));
-       assertEquals(true,  pictureTable.hasPicture(p.getCharacterRun(3)));
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(4)));
-       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(5)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(0)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(1)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(2)));
+        assertTrue(pictureTable.hasPicture(p.getCharacterRun(3)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(4)));
+        assertFalse(pictureTable.hasPicture(p.getCharacterRun(5)));
 
        // Look at the pictures table
        List<Picture> pictures = pictureTable.getAllPictures();
index ed79510f40c11285b7dd14de8ddec3ad0d106508..717f74fe6d6f2af415b98750502539ff755292b0 100644 (file)
@@ -19,26 +19,29 @@ package org.apache.poi.hpsf.basic;
 
 import java.util.Locale;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
 import org.apache.poi.hpsf.ClassID;
 import org.apache.poi.hpsf.DocumentSummaryInformation;
 import org.apache.poi.hpsf.PropertySet;
 import org.apache.poi.hpsf.SummaryInformation;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
 
 /**
  * <p>Tests ClassID structure.</p>
  *
  * @author Michael Zalewski (zalewski@optonline.net)
  */
-public final class TestClassID extends TestCase {
+public final class TestClassID {
 
     /**
      * Various tests of overridden .equals()
      */
-    public void testEquals()
-    {
+    @Test
+    public void testEquals() {
         ClassID clsidTest1 = new ClassID(
               new byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
                           0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10}
@@ -54,17 +57,18 @@ public final class TestClassID extends TestCase {
                           0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x11 }
             , 0
         );
-        Assert.assertEquals(clsidTest1, clsidTest1);
-        Assert.assertEquals(clsidTest1, clsidTest2);
-        Assert.assertFalse(clsidTest1.equals(clsidTest3));
-        Assert.assertFalse(clsidTest1.equals(null));
+        assertEquals(clsidTest1, clsidTest1);
+        assertEquals(clsidTest1, clsidTest2);
+        assertNotEquals(clsidTest1, clsidTest3);
+        assertNotEquals(null, clsidTest1);
     }
+    
     /**
      * Try to write to a buffer that is too small. This should
      *   throw an Exception
      */
-    public void testWriteArrayStoreException()
-    {
+    @Test
+    public void testWriteArrayStoreException() {
         ClassID clsidTest = new ClassID(
               new byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
                           0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10}
@@ -79,7 +83,7 @@ public final class TestClassID extends TestCase {
         {
             bExceptionOccurred = true;
         }
-        Assert.assertTrue(bExceptionOccurred);
+        assertTrue(bExceptionOccurred);
 
         bExceptionOccurred = false;
         try
@@ -90,7 +94,7 @@ public final class TestClassID extends TestCase {
         {
             bExceptionOccurred = true;
         }
-        Assert.assertTrue(bExceptionOccurred);
+        assertTrue(bExceptionOccurred);
 
         // These should work without throwing an Exception
         bExceptionOccurred = false;
@@ -103,21 +107,22 @@ public final class TestClassID extends TestCase {
         {
             bExceptionOccurred = true;
         }
-        Assert.assertFalse(bExceptionOccurred);
+        assertFalse(bExceptionOccurred);
     }
+
     /**
      * <p>Tests the {@link PropertySet} methods. The test file has two
      * property set: the first one is a {@link SummaryInformation},
      * the second one is a {@link DocumentSummaryInformation}.</p>
      */
-    public void testClassID()
-    {
+    @Test
+    public void testClassID() {
         ClassID clsidTest = new ClassID(
               new byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
                           0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10}
             , 0
         );
-        Assert.assertEquals(clsidTest.toString().toUpperCase(Locale.ROOT),
+        assertEquals(clsidTest.toString().toUpperCase(Locale.ROOT),
                             "{04030201-0605-0807-090A-0B0C0D0E0F10}"
         );
     }
index a4618aed470f08fd64d815ff529c89626092f53e..18384de5d8472d785202aab68efb62bc33c1bec3 100644 (file)
@@ -55,7 +55,7 @@ public final class TestAbortableListener extends TestCase {
                HSSFEventFactory f = new HSSFEventFactory();
 
                assertEquals(0, l.countSeen);
-               assertEquals(null, l.lastRecordSeen);
+        assertNull(l.lastRecordSeen);
 
                POIFSFileSystem fs = openSample();
                short res = f.abortableProcessWorkbookEvents(req, fs);
@@ -75,7 +75,7 @@ public final class TestAbortableListener extends TestCase {
                HSSFEventFactory f = new HSSFEventFactory();
 
                assertEquals(0, l.countSeen);
-               assertEquals(null, l.lastRecordSeen);
+        assertNull(l.lastRecordSeen);
 
                POIFSFileSystem fs = openSample();
                short res = f.abortableProcessWorkbookEvents(req, fs);
index b3bf6688047ee4bebcba759ebfa068938173a211..eacfdd51bbe47927a8a236811a4967b558aa13df 100644 (file)
@@ -92,8 +92,8 @@ public final class TestEventRecordFactory extends TestCase {
         byte[] bytes = bof.serialize();
             
         Record[] records = RecordFactory.createRecord(TestcaseRecordInputStream.create(bytes));
-        
-        assertTrue("record.length must be 1, was ="+records.length,records.length == 1);
+
+        assertEquals("record.length must be 1, was =" + records.length, 1, records.length);
         assertTrue("record is the same", compareRec(bof,records[0]));
         
     }
index f051529b753281da3214b9b8cb31d0818e2104a1..82b1409dbd78ca0269599d8981135a46e8e612d9 100644 (file)
@@ -20,6 +20,7 @@ import static org.apache.poi.poifs.storage.RawDataUtil.decompress;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -149,8 +150,7 @@ public class TestDrawingAggregate {
                 byte[] dgBytes2 = agg.serialize();
 
                 assertEquals("different size of raw data ande aggregate.serialize()", dgBytes1.length, dgBytes2.length);
-                assertTrue("raw drawing data ("+dgBytes1.length+" bytes) and aggregate.serialize() are different.",
-                        Arrays.equals(dgBytes1, dgBytes2));
+                assertArrayEquals("raw drawing data (" + dgBytes1.length + " bytes) and aggregate.serialize() are different.", dgBytes1, dgBytes2);
             }
         }
 
@@ -164,8 +164,7 @@ public class TestDrawingAggregate {
                     byte[] dgBytes1 = info1.getRawBytes();
                     byte[] dgBytes2 = info2.getRawBytes();
                     assertEquals("different size of drawing data before and after save", dgBytes1.length, dgBytes2.length);
-                    assertTrue("drawing data ("+dgBytes1.length+" bytes) before and after save is different.",
-                            Arrays.equals(dgBytes1, dgBytes2));
+                    assertArrayEquals("drawing data (" + dgBytes1.length + " bytes) before and after save is different.", dgBytes1, dgBytes2);
                 }
             }
             wb2.close();
@@ -295,7 +294,7 @@ public class TestDrawingAggregate {
         agg = (EscherAggregate) ish.findFirstRecordBySid(EscherAggregate.sid);
         byte[] dgBytesAfterSave = agg.serialize();
         assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
-        assertTrue("drawing data before and after save is different", Arrays.equals(dgBytes, dgBytesAfterSave));
+        assertArrayEquals("drawing data before and after save is different", dgBytes, dgBytesAfterSave);
         wb2.close();
     }
 
@@ -314,7 +313,7 @@ public class TestDrawingAggregate {
         EscherAggregate agg = (EscherAggregate) ish.findFirstRecordBySid(EscherAggregate.sid);
         byte[] dgBytesAfterSave = agg.serialize();
         assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
-        assertTrue("drawing data before and after save is different", Arrays.equals(dgBytes, dgBytesAfterSave));
+        assertArrayEquals("drawing data before and after save is different", dgBytes, dgBytesAfterSave);
         wb.close();
     }
 
@@ -338,7 +337,7 @@ public class TestDrawingAggregate {
                 System.out.println("pos = " + i);
             }
         }
-        assertTrue("drawing data before and after save is different", Arrays.equals(dgBytes, dgBytesAfterSave));
+        assertArrayEquals("drawing data before and after save is different", dgBytes, dgBytesAfterSave);
         wb.close();
     }
 
@@ -401,7 +400,7 @@ public class TestDrawingAggregate {
 
         byte[] dgBytesAfterSave = agg.serialize();
         assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
-        assertTrue("drawing data before and after save is different", Arrays.equals(dgBytes, dgBytesAfterSave));
+        assertArrayEquals("drawing data before and after save is different", dgBytes, dgBytesAfterSave);
         wb.close();
     }
 
@@ -469,7 +468,7 @@ public class TestDrawingAggregate {
 
         byte[] dgBytesAfterSave = agg.serialize();
         assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
-        assertTrue("drawing data before and after save is different", Arrays.equals(dgBytes, dgBytesAfterSave));
+        assertArrayEquals("drawing data before and after save is different", dgBytes, dgBytesAfterSave);
         wb.close();
     }
 
@@ -490,7 +489,7 @@ public class TestDrawingAggregate {
         for (int i = 0; i < records.size(); i++) {
             RecordBase r1 = records.get(i);
             RecordBase r2 = records2.get(i);
-            assertTrue(r1.getClass() == r2.getClass());
+            assertSame(r1.getClass(), r2.getClass());
             assertEquals(r1.getRecordSize(), r2.getRecordSize());
             if (r1 instanceof Record) {
                 assertEquals(((Record) r1).getSid(), ((Record) r2).getSid());
@@ -555,7 +554,7 @@ public class TestDrawingAggregate {
 
         byte[] dgBytesAfterSave = agg.serialize();
         assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
-        assertTrue("drawing data before and after save is different", Arrays.equals(dgBytes, dgBytesAfterSave));
+        assertArrayEquals("drawing data before and after save is different", dgBytes, dgBytesAfterSave);
         wb.close();
     }
 
@@ -615,7 +614,7 @@ public class TestDrawingAggregate {
 
         byte[] dgBytesAfterSave = agg.serialize();
         assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
-        assertTrue("drawing data before and after save is different", Arrays.equals(dgBytes, dgBytesAfterSave));
+        assertArrayEquals("drawing data before and after save is different", dgBytes, dgBytesAfterSave);
         wb.close();
     }
 
@@ -768,7 +767,7 @@ public class TestDrawingAggregate {
 
         byte[] dgBytesAfterSave = agg.serialize();
         assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
-        assertTrue("drawing data before and after save is different", Arrays.equals(dgBytes, dgBytesAfterSave));
+        assertArrayEquals("drawing data before and after save is different", dgBytes, dgBytesAfterSave);
     }
 
     @Test
@@ -941,6 +940,6 @@ public class TestDrawingAggregate {
 
         byte[] dgBytesAfterSave = agg.serialize();
         assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
-        assertTrue("drawing data brefpore and after save is different", Arrays.equals(dgBytes, dgBytesAfterSave));
+        assertArrayEquals("drawing data brefpore and after save is different", dgBytes, dgBytesAfterSave);
     }
 }
index 7b1c2078c16c68bb13456e15699c794dc5b0184a..905641f0a3c169dccc12415bfafe4e293e47da30 100644 (file)
@@ -31,10 +31,11 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.util.Arrays;
 import java.util.List;
 import java.util.Random;
 
+import static org.junit.Assert.assertArrayEquals;
+
 /**
  * @author Evgeniy Berlog
  * @date 18.06.12
@@ -56,26 +57,26 @@ public class TestEscherRecordFactory extends TestCase{
 
     public void testDetectContainer() {
         Random rnd = new Random();
-        assertEquals(true, DefaultEscherRecordFactory.isContainer((short) 0x0, EscherContainerRecord.DG_CONTAINER));
-        assertEquals(true, DefaultEscherRecordFactory.isContainer((short) 0x0, EscherContainerRecord.SOLVER_CONTAINER));
-        assertEquals(true, DefaultEscherRecordFactory.isContainer((short) 0x0, EscherContainerRecord.SP_CONTAINER));
-        assertEquals(true, DefaultEscherRecordFactory.isContainer((short) 0x0, EscherContainerRecord.DGG_CONTAINER));
-        assertEquals(true, DefaultEscherRecordFactory.isContainer((short) 0x0, EscherContainerRecord.BSTORE_CONTAINER));
-        assertEquals(true, DefaultEscherRecordFactory.isContainer((short) 0x0, EscherContainerRecord.SPGR_CONTAINER));
+        assertTrue(DefaultEscherRecordFactory.isContainer((short) 0x0, EscherContainerRecord.DG_CONTAINER));
+        assertTrue(DefaultEscherRecordFactory.isContainer((short) 0x0, EscherContainerRecord.SOLVER_CONTAINER));
+        assertTrue(DefaultEscherRecordFactory.isContainer((short) 0x0, EscherContainerRecord.SP_CONTAINER));
+        assertTrue(DefaultEscherRecordFactory.isContainer((short) 0x0, EscherContainerRecord.DGG_CONTAINER));
+        assertTrue(DefaultEscherRecordFactory.isContainer((short) 0x0, EscherContainerRecord.BSTORE_CONTAINER));
+        assertTrue(DefaultEscherRecordFactory.isContainer((short) 0x0, EscherContainerRecord.SPGR_CONTAINER));
 
         for (Short i=EscherContainerRecord.DGG_CONTAINER; i<= EscherContainerRecord.SOLVER_CONTAINER; i++){
-            assertEquals(true, DefaultEscherRecordFactory.isContainer(Integer.valueOf(rnd.nextInt(Short.MAX_VALUE)).shortValue(), i));
+            assertTrue(DefaultEscherRecordFactory.isContainer(Integer.valueOf(rnd.nextInt(Short.MAX_VALUE)).shortValue(), i));
         }
 
-        assertEquals(false, DefaultEscherRecordFactory.isContainer((short) 0x0, Integer.valueOf(EscherContainerRecord.DGG_CONTAINER-1).shortValue()));
-        assertEquals(false, DefaultEscherRecordFactory.isContainer((short) 0x0, Integer.valueOf(EscherContainerRecord.SOLVER_CONTAINER+1).shortValue()));
+        assertFalse(DefaultEscherRecordFactory.isContainer((short) 0x0, Integer.valueOf(EscherContainerRecord.DGG_CONTAINER - 1).shortValue()));
+        assertFalse(DefaultEscherRecordFactory.isContainer((short) 0x0, Integer.valueOf(EscherContainerRecord.SOLVER_CONTAINER + 1).shortValue()));
 
-        assertEquals(true, DefaultEscherRecordFactory.isContainer((short) 0x000F, Integer.valueOf(EscherContainerRecord.DGG_CONTAINER-1).shortValue()));
-        assertEquals(true, DefaultEscherRecordFactory.isContainer((short) 0xFFFF, Integer.valueOf(EscherContainerRecord.DGG_CONTAINER-1).shortValue()));
-        assertEquals(false, DefaultEscherRecordFactory.isContainer((short) 0x000C, Integer.valueOf(EscherContainerRecord.DGG_CONTAINER-1).shortValue()));
-        assertEquals(false, DefaultEscherRecordFactory.isContainer((short) 0xCCCC, Integer.valueOf(EscherContainerRecord.DGG_CONTAINER-1).shortValue()));
-        assertEquals(false, DefaultEscherRecordFactory.isContainer((short) 0x000F, EscherTextboxRecord.RECORD_ID));
-        assertEquals(false, DefaultEscherRecordFactory.isContainer((short) 0xCCCC, EscherTextboxRecord.RECORD_ID));
+        assertTrue(DefaultEscherRecordFactory.isContainer((short) 0x000F, Integer.valueOf(EscherContainerRecord.DGG_CONTAINER - 1).shortValue()));
+        assertTrue(DefaultEscherRecordFactory.isContainer((short) 0xFFFF, Integer.valueOf(EscherContainerRecord.DGG_CONTAINER - 1).shortValue()));
+        assertFalse(DefaultEscherRecordFactory.isContainer((short) 0x000C, Integer.valueOf(EscherContainerRecord.DGG_CONTAINER - 1).shortValue()));
+        assertFalse(DefaultEscherRecordFactory.isContainer((short) 0xCCCC, Integer.valueOf(EscherContainerRecord.DGG_CONTAINER - 1).shortValue()));
+        assertFalse(DefaultEscherRecordFactory.isContainer((short) 0x000F, EscherTextboxRecord.RECORD_ID));
+        assertFalse(DefaultEscherRecordFactory.isContainer((short) 0xCCCC, EscherTextboxRecord.RECORD_ID));
     }
 
     public void testDgContainerMustBeRootOfHSSFSheetEscherRecords() throws IOException {
@@ -88,12 +89,12 @@ public class TestEscherRecordFactory extends TestCase{
         byte[] dgBytes = toByteArray(dgRecords);
         sh.getDrawingPatriarch();
         EscherAggregate agg = (EscherAggregate) ish.findFirstRecordBySid(EscherAggregate.sid);
-        assertEquals(true, agg.getEscherRecords().get(0) instanceof EscherContainerRecord);
+        assertTrue(agg.getEscherRecords().get(0) instanceof EscherContainerRecord);
         assertEquals(EscherContainerRecord.DG_CONTAINER, agg.getEscherRecords().get(0).getRecordId());
         assertEquals((short) 0x0, agg.getEscherRecords().get(0).getOptions());
         agg = (EscherAggregate) ish.findFirstRecordBySid(EscherAggregate.sid);
         byte[] dgBytesAfterSave = agg.serialize();
         assertEquals("different size of drawing data before and after save", dgBytes.length, dgBytesAfterSave.length);
-        assertTrue("drawing data before and after save is different", Arrays.equals(dgBytes, dgBytesAfterSave));
+        assertArrayEquals("drawing data before and after save is different", dgBytes, dgBytesAfterSave);
     }
 }
index 349043b9c9e2834899d19fce1501e9745710c3ce..b95b700bfb9e4e67a0c1e9e0b12c5c5c0f778e6e 100644 (file)
@@ -132,7 +132,7 @@ public final class TestFormulaParser {
         Ptg[] ptgs = parseFormula("TRUE");
         assertEquals(1, ptgs.length);
         BoolPtg flag  = (BoolPtg) ptgs[0];
-        assertEquals(true, flag.getValue());
+        assertTrue(flag.getValue());
     }
 
     @Test
@@ -300,18 +300,18 @@ public final class TestFormulaParser {
         String value = "  hi  ";
         Ptg[] ptgs = parseFormula("\"" + value + "\"");
         confirmTokenClasses(ptgs, StringPtg.class);
-        assertTrue("ptg0 contains exact value", ((StringPtg)ptgs[0]).getValue().equals(value));
+        assertEquals("ptg0 contains exact value", ((StringPtg) ptgs[0]).getValue(), value);
     }
 
     @Test
     public void testLookupAndMatchFunctionArgs() {
         Ptg[] ptgs = parseFormula("lookup(A1, A3:A52, B3:B52)");
         confirmTokenClasses(ptgs, RefPtg.class, AreaPtg.class, AreaPtg.class, FuncVarPtg.class);
-        assertTrue("ptg0 has Value class", ptgs[0].getPtgClass() == Ptg.CLASS_VALUE);
+        assertEquals("ptg0 has Value class", ptgs[0].getPtgClass(), Ptg.CLASS_VALUE);
 
         ptgs = parseFormula("match(A1, A3:A52)");
         confirmTokenClasses(ptgs, RefPtg.class, AreaPtg.class, FuncVarPtg.class);
-        assertTrue("ptg0 has Value class", ptgs[0].getPtgClass() == Ptg.CLASS_VALUE);
+        assertEquals("ptg0 has Value class", ptgs[0].getPtgClass(), Ptg.CLASS_VALUE);
     }
 
     /** bug 33160*/
index 53f5f4ac75660818dc2505a96efe8bd0adee87f9..d7ab7aa48d49c25ac77ca4b10464bb90552c60c3 100644 (file)
@@ -70,7 +70,7 @@ public final class TestFormulaParserEval extends TestCase {
         */
        private static void confirmParseFormula(HSSFWorkbook workbook) {
                Ptg[] ptgs = HSSFFormulaParser.parse("SUM(testName)", workbook);
-               assertTrue("two tokens expected, got "+ptgs.length,ptgs.length == 2);
+        assertEquals("two tokens expected, got " + ptgs.length, 2, ptgs.length);
                assertEquals(NamePtg.class, ptgs[0].getClass());
                assertEquals(AttrPtg.class, ptgs[1].getClass());
        }
index a069190f5f4be72ccbdbf89abfef3e2e43aad76a..250263392e38152579a31b762b72fabaf9fb0edf 100644 (file)
@@ -198,7 +198,7 @@ public final class TestFormulaParserIf extends TestCase {
                StringPtg n = (StringPtg) ptgs[4];
 
 
-               assertEquals(true, flag.getValue());
+        assertTrue(flag.getValue());
                assertEquals("Y", y.getValue());
                assertEquals("N", n.getValue());
                assertEquals("IF", funif.toFormulaString());
index c79b29928fc914ef1337a0c1b118d2864200e6d5..d05e1c8d0dd1a63ae687bc558b43743f15637b89 100644 (file)
 package org.apache.poi.hssf.model;
 
 import junit.framework.TestCase;
-import org.apache.poi.ddf.*;
+import org.apache.poi.ddf.EscherChildAnchorRecord;
+import org.apache.poi.ddf.EscherClientAnchorRecord;
+import org.apache.poi.ddf.EscherClientDataRecord;
+import org.apache.poi.ddf.EscherContainerRecord;
+import org.apache.poi.ddf.EscherOptRecord;
+import org.apache.poi.ddf.EscherSpRecord;
 import org.apache.poi.hssf.HSSFTestDataSamples;
-import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.hssf.usermodel.HSSFAnchor;
+import org.apache.poi.hssf.usermodel.HSSFChildAnchor;
+import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
+import org.apache.poi.hssf.usermodel.HSSFPatriarch;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFSimpleShape;
+import org.apache.poi.hssf.usermodel.HSSFTestHelper;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType;
+import org.junit.Assert;
 
-/**
- * @author Evgeniy Berlog
- * @date 12.06.12
- */
 public class TestHSSFAnchor extends TestCase {
 
     public void testDefaultValues(){
@@ -100,6 +109,7 @@ public class TestHSSFAnchor extends TestCase {
         container.addChildRecord(escher);
 
         HSSFClientAnchor anchor = (HSSFClientAnchor) HSSFAnchor.createAnchorFromEscher(container);
+        assertNotNull(anchor);
         assertEquals(anchor.getCol1(), 11);
         assertEquals(escher.getCol1(), 11);
         assertEquals(anchor.getCol2(), 12);
@@ -128,6 +138,7 @@ public class TestHSSFAnchor extends TestCase {
         container.addChildRecord(escher);
 
         HSSFChildAnchor anchor = (HSSFChildAnchor) HSSFAnchor.createAnchorFromEscher(container);
+        assertNotNull(anchor);
         assertEquals(anchor.getDx1(), 15);
         assertEquals(escher.getDx1(), 15);
         assertEquals(anchor.getDx2(), 16);
@@ -153,7 +164,7 @@ public class TestHSSFAnchor extends TestCase {
 
         assertNotNull(HSSFTestHelper.getEscherAnchor(anchor));
         assertNotNull(HSSFTestHelper.getEscherContainer(rectangle));
-        assertTrue(HSSFTestHelper.getEscherAnchor(anchor).equals(HSSFTestHelper.getEscherContainer(rectangle).getChildById(EscherClientAnchorRecord.RECORD_ID)));
+        assertEquals(HSSFTestHelper.getEscherAnchor(anchor), HSSFTestHelper.getEscherContainer(rectangle).getChildById(EscherClientAnchorRecord.RECORD_ID));
     }
 
     public void testClientAnchorFromEscher(){
@@ -298,24 +309,24 @@ public class TestHSSFAnchor extends TestCase {
 
     public void testNullReferenceIsFalse() {
         HSSFClientAnchor clientAnchor = new HSSFClientAnchor(0, 1, 2, 3, (short)4, 5, (short)6, 7);
-        assertFalse("Passing null to equals should return false", clientAnchor.equals(null));
+        Assert.assertNotNull("Passing null to equals should return false", clientAnchor);
 
         HSSFChildAnchor childAnchor = new HSSFChildAnchor(0, 1, 2, 3);
-        assertFalse("Passing null to equals should return false", childAnchor.equals(null));
+        assertNotNull("Passing null to equals should return false", childAnchor);
     }
 
     public void testEqualsIsReflexiveIsSymmetric() {
         HSSFClientAnchor clientAnchor1 = new HSSFClientAnchor(0, 1, 2, 3, (short)4, 5, (short)6, 7);
         HSSFClientAnchor clientAnchor2 = new HSSFClientAnchor(0, 1, 2, 3, (short)4, 5, (short)6, 7);
 
-        assertTrue(clientAnchor1.equals(clientAnchor2));
-        assertTrue(clientAnchor1.equals(clientAnchor2));
+        assertEquals(clientAnchor1, clientAnchor2);
+        assertEquals(clientAnchor1, clientAnchor2);
 
         HSSFChildAnchor childAnchor1 = new HSSFChildAnchor(0, 1, 2, 3);
         HSSFChildAnchor childAnchor2 = new HSSFChildAnchor(0, 1, 2, 3);
 
-        assertTrue(childAnchor1.equals(childAnchor2));
-        assertTrue(childAnchor2.equals(childAnchor1));
+        assertEquals(childAnchor1, childAnchor2);
+        assertEquals(childAnchor2, childAnchor1);
     }
 
     public void testEqualsValues(){
@@ -394,32 +405,32 @@ public class TestHSSFAnchor extends TestCase {
 
     public void testFlipped(){
         HSSFChildAnchor child = new HSSFChildAnchor(2,2,1,1);
-        assertEquals(child.isHorizontallyFlipped(), true);
-        assertEquals(child.isVerticallyFlipped(), true);
+        assertTrue(child.isHorizontallyFlipped());
+        assertTrue(child.isVerticallyFlipped());
         assertEquals(child.getDx1(), 1);
         assertEquals(child.getDx2(), 2);
         assertEquals(child.getDy1(), 1);
         assertEquals(child.getDy2(), 2);
 
         child = new HSSFChildAnchor(3,3,4,4);
-        assertEquals(child.isHorizontallyFlipped(), false);
-        assertEquals(child.isVerticallyFlipped(), false);
+        assertFalse(child.isHorizontallyFlipped());
+        assertFalse(child.isVerticallyFlipped());
         assertEquals(child.getDx1(), 3);
         assertEquals(child.getDx2(), 4);
         assertEquals(child.getDy1(), 3);
         assertEquals(child.getDy2(), 4);
 
         HSSFClientAnchor client = new HSSFClientAnchor(1,1,1,1, (short)4,4,(short)3,3);
-        assertEquals(client.isVerticallyFlipped(), true);
-        assertEquals(client.isHorizontallyFlipped(), true);
+        assertTrue(client.isVerticallyFlipped());
+        assertTrue(client.isHorizontallyFlipped());
         assertEquals(client.getCol1(), 3);
         assertEquals(client.getCol2(), 4);
         assertEquals(client.getRow1(), 3);
         assertEquals(client.getRow2(), 4);
 
         client = new HSSFClientAnchor(1,1,1,1, (short)5,5,(short)6,6);
-        assertEquals(client.isVerticallyFlipped(), false);
-        assertEquals(client.isHorizontallyFlipped(), false);
+        assertFalse(client.isVerticallyFlipped());
+        assertFalse(client.isHorizontallyFlipped());
         assertEquals(client.getCol1(), 5);
         assertEquals(client.getCol2(), 6);
         assertEquals(client.getRow1(), 5);
index fbd562b444439bc795d335c803d40c51ba8a6955..a6f8414a929a81a0af9bda98d65f2049db0049ee 100644 (file)
@@ -181,8 +181,8 @@ public final class TestLinkTable extends TestCase {
                assertNotNull(lt);
 
                assertEquals(2, commentRecords.size());
-    assertTrue(recs[1] == commentRecords.get("name1")); //== is intentionally not .equals()!
-    assertTrue(recs[3] == commentRecords.get("name2")); //== is intentionally not .equals()!
+        assertSame(recs[1], commentRecords.get("name1")); //== is intentionally not .equals()!
+        assertSame(recs[3], commentRecords.get("name2")); //== is intentionally not .equals()!
 
     assertEquals(2, lt.getNumNames());
        }
index 7ebb8a401c6e268872a10a2d1b8dfabb87e07e10..84d5e6501556347f5927fda6f11ca47e67f3ef39 100644 (file)
@@ -140,11 +140,11 @@ public final class TestSheet {
                for (int n = 0; n < regionsToAdd; n++)
                {
                        int index = sheet.addMergedRegion(0, (short) 0, 1, (short) 1);
-                       assertTrue("Merged region index expected to be " + n + " got " + index, index == n);
+            assertEquals("Merged region index expected to be " + n + " got " + index, index, n);
                }
 
                //test all the regions were indeed added
-               assertTrue(sheet.getNumMergedRegions() == regionsToAdd);
+        assertEquals(sheet.getNumMergedRegions(), regionsToAdd);
 
                //test that the regions were spread out over the appropriate number of records
                MergedCellListener mcListener = new MergedCellListener();
@@ -153,8 +153,8 @@ public final class TestSheet {
                int recordsExpected = regionsToAdd/1027;
                if ((regionsToAdd % 1027) != 0)
                        recordsExpected++;
-               assertTrue("The " + regionsToAdd + " merged regions should have been spread out over "
-                               + recordsExpected + " records, not " + recordsAdded, recordsAdded == recordsExpected);
+        assertEquals("The " + regionsToAdd + " merged regions should have been spread out over "
+                + recordsExpected + " records, not " + recordsAdded, recordsAdded, recordsExpected);
                // Check we can't add one with invalid date
                try {
                        sheet.addMergedRegion(10, (short)10, 9, (short)12);
index 558a5ec0ff5568be11bf6a13692edf08d5a5aceb..d3e99e510cd1000b1f1f8925101130d3665bbe3e 100644 (file)
@@ -140,7 +140,7 @@ public final class TestWorkbook {
         int countryPos = iwb.findFirstRecordLocBySid(CountryRecord.sid);
         assertTrue(countryPos != -1);
         // RecalcIdRecord is not present in new workbooks
-        assertEquals(null, iwb.findFirstRecordBySid(RecalcIdRecord.sid));
+        assertNull(iwb.findFirstRecordBySid(RecalcIdRecord.sid));
         RecalcIdRecord record = iwb.getRecalcId();
         assertNotNull(record);
         assertSame(record, iwb.getRecalcId());
index 9223dc99679ce1c9030d7343c5b5ffef6b5c2170..7f34a1c5dcae69e30598913a09eefcb2a63958dd 100644 (file)
@@ -70,7 +70,7 @@ public final class TestBoolErrRecord extends TestCase {
                }
                assertFalse(hasMore);
                assertTrue(ber.isBoolean());
-               assertEquals(true, ber.getBooleanValue());
+        assertTrue(ber.getBooleanValue());
                
                // Check that the record re-serializes correctly
                byte[] outData = ber.serialize();
index 9c9b5486cf42a66b7fb956967538a6e20d0c0b95..57ae686b0c8b7405be4f9c09a1d070155258467a 100644 (file)
@@ -45,17 +45,17 @@ public final class TestCFHeaderRecord extends TestCase {
                assertEquals(65535, enclosingCellRange.getLastRow());
                assertEquals(0, enclosingCellRange.getFirstColumn());
                assertEquals(6, enclosingCellRange.getLastColumn());
-               
-               assertEquals(false, record.getNeedRecalculation());
+
+        assertFalse(record.getNeedRecalculation());
                assertEquals(0, record.getID());
                
                record.setNeedRecalculation(true);
-        assertEquals(true, record.getNeedRecalculation());
+        assertTrue(record.getNeedRecalculation());
         assertEquals(0, record.getID());
         
         record.setID(7);
                record.setNeedRecalculation(false);
-        assertEquals(false, record.getNeedRecalculation());
+        assertFalse(record.getNeedRecalculation());
         assertEquals(7, record.getID());
        }
        
@@ -78,16 +78,16 @@ public final class TestCFHeaderRecord extends TestCase {
         assertEquals(0, enclosingCellRange.getFirstColumn());
         assertEquals(6, enclosingCellRange.getLastColumn());
 
-        assertEquals(false, record.getNeedRecalculation());
+        assertFalse(record.getNeedRecalculation());
         assertEquals(0, record.getID());
         
         record.setNeedRecalculation(true);
-        assertEquals(true, record.getNeedRecalculation());
+        assertTrue(record.getNeedRecalculation());
         assertEquals(0, record.getID());
         
         record.setID(7);
         record.setNeedRecalculation(false);
-        assertEquals(false, record.getNeedRecalculation());
+        assertFalse(record.getNeedRecalculation());
         assertEquals(7, record.getID());
     }
     
index 8e5b48276185a91f40c6b24e2cae4a7580469380..b2c56686fa336c84f5cde69b7859828a1a15d3e7 100644 (file)
@@ -41,9 +41,9 @@ public final class TestColumnInfoRecord extends TestCase {
                assertEquals(155, cir.getLastColumn());
                assertEquals(6599, cir.getColumnWidth());
                assertEquals(15, cir.getXFIndex());
-               assertEquals(true, cir.getHidden());
+        assertTrue(cir.getHidden());
                assertEquals(3, cir.getOutlineLevel());
-               assertEquals(true, cir.getCollapsed());
+        assertTrue(cir.getCollapsed());
                assertArrayEquals(data, cir.serialize());
        }
 
index 7ff862385260999c870365956abad2f0f9e696b9..5f0ac2e4e999ca7da70f4eb420dce8fff4f824e6 100644 (file)
@@ -42,10 +42,10 @@ public final class TestCommonObjectDataSubRecord extends TestCase {
                assertEquals( CommonObjectDataSubRecord.OBJECT_TYPE_LIST_BOX, record.getObjectType());
                assertEquals((short) 1, record.getObjectId());
                assertEquals((short) 1, record.getOption());
-               assertEquals(true, record.isLocked());
-               assertEquals(false, record.isPrintable());
-               assertEquals(false, record.isAutofill());
-               assertEquals(false, record.isAutoline());
+        assertTrue(record.isLocked());
+        assertFalse(record.isPrintable());
+        assertFalse(record.isAutofill());
+        assertFalse(record.isAutoline());
                assertEquals(24593, record.getReserved1());
                assertEquals(218103808, record.getReserved2());
                assertEquals(294, record.getReserved3());
index 98f4d8692069dbfe29b77efe7f056fc00a6c08d5..5962e7876707a6f0523179bf3825e74d2c9b7e7c 100644 (file)
@@ -25,6 +25,8 @@ import java.util.Arrays;
 import junit.framework.TestCase;
 import org.apache.poi.util.LittleEndianOutputStream;
 
+import static org.junit.Assert.assertArrayEquals;
+
 /**
  * Unit tests for DConRefRecord class.
  *
@@ -184,7 +186,6 @@ public class TestDConRefRecord extends TestCase
     /**
      * test read-constructor-then-serialize for a single-byte external reference strings of
      * various flavours. This uses the RecordInputStream constructor.
-     * @throws IOException
      */
     public void testReadWriteSBExtRef() throws IOException
     {
@@ -210,8 +211,6 @@ public class TestDConRefRecord extends TestCase
     /**
      * test read-constructor-then-serialize for a double-byte external reference 'UNC-Volume' style
      * string
-     * <p>
-     * @throws IOException
      */
     public void testReadWriteDBExtRefUncVol() throws IOException
     {
@@ -227,14 +226,11 @@ public class TestDConRefRecord extends TestCase
         d.serialize(o);
         o.flush();
 
-        assertTrue(message, Arrays.equals(data,
-                bos.toByteArray()));
+        assertArrayEquals(message, data, bos.toByteArray());
     }
 
     /**
      * test read-constructor-then-serialize for a double-byte self-reference style string
-     * <p>
-     * @throws IOException
      */
     public void testReadWriteDBSelfRef() throws IOException
     {
@@ -243,8 +239,6 @@ public class TestDConRefRecord extends TestCase
 
     /**
      * test read-constructor-then-serialize for a single-byte self-reference style string
-     * <p>
-     * @throws IOException
      */
     public void testReadWriteSBSelfRef() throws IOException
     {
@@ -289,7 +283,7 @@ public class TestDConRefRecord extends TestCase
         DConRefRecord instance = new DConRefRecord(TestcaseRecordInputStream.create(81, data1));
         byte[] expResult = Arrays.copyOfRange(data1, 9, data1.length);
         byte[] result = instance.getPath();
-        assertTrue("get path", Arrays.equals(expResult, result));
+        assertArrayEquals("get path", expResult, result);
     }
 
     /**
index 7a126c57a9eb4a41a0918ddec740e7723d1ddb69..228e728ae8a5048782d5fbe6ea765e646de9d6d2 100644 (file)
@@ -826,7 +826,7 @@ public final class TestExtSSTRecord extends TestCase {
             UnicodeString us1 = expected.getString(k);
             UnicodeString us2 = actual.getString(k);
 
-            assertTrue("String at idx=" + k, us1.equals(us2));
+            assertEquals("String at idx=" + k, us1, us2);
         }
     }
 
index e0d14b8da95c0f1ae2e8d9c5abcd0d377501b770..ab80faf510e7e1987eecb2d7ef527189d649ac62 100644 (file)
@@ -187,7 +187,7 @@ public final class TestFormulaRecord extends TestCase {
                if (fr0.getCachedBooleanValue() && !fr1.getCachedBooleanValue()) {
                        throw new AssertionFailedError("Identified bug 46479c");
                }
-               assertEquals(false, fr0.getCachedBooleanValue());
-               assertEquals(true, fr1.getCachedBooleanValue());
+        assertFalse(fr0.getCachedBooleanValue());
+        assertTrue(fr1.getCachedBooleanValue());
        }
 }
index fdc2fd779e290beaa5a9646bdf69ae342f55f5db..f002aa8ebc8df9bfc93f8e877b289a5c9d83d9e7 100644 (file)
@@ -52,9 +52,9 @@ public final class TestMergeCellsRecord extends TestCase {
                assertEquals("New Clone Row From doesnt match", mergeRegion.getFirstRow(), cloneRegion.getFirstRow());
                assertEquals("New Clone Row To doesnt match", mergeRegion.getLastRow(), cloneRegion.getLastRow());
                assertEquals("New Clone Col From doesnt match", mergeRegion.getFirstColumn(), cloneRegion.getFirstColumn());
-               assertEquals("New Clone Col To doesnt match", mergeRegion.getLastColumn(), cloneRegion.getLastColumn());      
-      
-               assertFalse(merge.getAreaAt(0) == clone.getAreaAt(0));
+               assertEquals("New Clone Col To doesnt match", mergeRegion.getLastColumn(), cloneRegion.getLastColumn());
+
+        assertNotSame(merge.getAreaAt(0), clone.getAreaAt(0));
        }
    
        private static final RecordVisitor dummyRecordVisitor = new RecordVisitor() {
index cd98ee0840bbb02611ef1df9d00d447d05427a83..01f3ded891ffc95c2cf9e61f3c7ef5700160bd9f 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.poi.hssf.record;
 
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -82,7 +83,7 @@ public final class TestSSTRecord {
         in.nextRecord();
         SSTRecord result = new SSTRecord(in);
         assertEquals(0, in.remaining());
-        assertTrue(!in.hasNextRecord());
+        assertFalse(in.hasNextRecord());
         return result;
     }
 
@@ -1468,7 +1469,7 @@ public final class TestSSTRecord {
             org.apache.poi.hssf.record.common.UnicodeString us1 = expected.getString(k);
             org.apache.poi.hssf.record.common.UnicodeString us2 = actual.getString(k);
 
-            assertTrue("String at idx=" + k, us1.equals(us2));
+            assertEquals("String at idx=" + k, us1, us2);
         }
     }
     
index 3bced93f6d517372f54bb7129377c9813ca0bd37..750e5b94270b50936d994907a490298990c1b72c 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.poi.hssf.record.aggregates;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -59,7 +60,7 @@ public final class TestRowRecordsAggregate {
 
                assertNotNull(rr1);
                assertEquals("Row number is 1", 4, rr1.getRowNumber());
-               assertTrue("Row record retrieved is identical ", rr1 == rr);
+        assertSame("Row record retrieved is identical ", rr1, rr);
        }
 
        /**
index c47a8b4f7ea82f92f9cfe06ea3997d7eeebd6a2e..1a1041cf7d6f7b4138ef891ab2c00a196b9791c7 100644 (file)
@@ -48,8 +48,8 @@ public final class TestAreaFormatRecord extends TestCase {
         assertEquals( 0x000000, record.getBackgroundColor());
         assertEquals( 1, record.getPattern());
         assertEquals( 1, record.getFormatFlags());
-        assertEquals( true, record.isAutomatic() );
-        assertEquals( false, record.isInvert() );
+        assertTrue(record.isAutomatic());
+        assertFalse(record.isInvert());
         assertEquals( 0x4e, record.getForecolorIndex());
         assertEquals( 0x4d, record.getBackcolorIndex());
 
index 2570d2e1c356f4f19a04c8130cad53f3ce2062b8..4d5f30e78362f56e895d5eb81f7bf526c0f5196b 100644 (file)
@@ -39,9 +39,9 @@ public final class TestAreaRecord extends TestCase {
 
         AreaRecord record = new AreaRecord(TestcaseRecordInputStream.create(0x101A, data));
         assertEquals( 2, record.getFormatFlags());
-        assertEquals( false, record.isStacked() );
-        assertEquals( true, record.isDisplayAsPercentage() );
-        assertEquals( false, record.isShadow() );
+        assertFalse(record.isStacked());
+        assertTrue(record.isDisplayAsPercentage());
+        assertFalse(record.isShadow());
 
 
         assertEquals( 6, record.getRecordSize() );
index 344bdee5d8e2ce6fb4394fab54a3a949a3e37de3..ebb5ba4637b9acb55530a33d17d82c593f8c86d5 100644 (file)
@@ -49,14 +49,14 @@ public final class TestAxisOptionsRecord extends TestCase {
         assertEquals( 0, record.getBaseUnit());
         assertEquals( 0, record.getCrossingPoint());
         assertEquals( 239, record.getOptions());
-        assertEquals( true, record.isDefaultMinimum() );
-        assertEquals( true, record.isDefaultMaximum() );
-        assertEquals( true, record.isDefaultMajor() );
-        assertEquals( true, record.isDefaultMinorUnit() );
-        assertEquals( false, record.isIsDate() );
-        assertEquals( true, record.isDefaultBase() );
-        assertEquals( true, record.isDefaultCross() );
-        assertEquals( true, record.isDefaultDateSettings() );
+        assertTrue(record.isDefaultMinimum());
+        assertTrue(record.isDefaultMaximum());
+        assertTrue(record.isDefaultMajor());
+        assertTrue(record.isDefaultMinorUnit());
+        assertFalse(record.isIsDate());
+        assertTrue(record.isDefaultBase());
+        assertTrue(record.isDefaultCross());
+        assertTrue(record.isDefaultDateSettings());
 
         assertEquals( 22, record.getRecordSize() );
     }
index 4781fe94185c3d842f075c8e3090e6c3c18842d6..90d2f81bb83e20e8c04d9161457c3e80f578ee63 100644 (file)
@@ -43,10 +43,10 @@ public final class TestBarRecord extends TestCase {
         assertEquals( 0, record.getBarSpace());
         assertEquals( 0x96, record.getCategorySpace());
         assertEquals( 0, record.getFormatFlags());
-        assertEquals( false, record.isHorizontal() );
-        assertEquals( false, record.isStacked() );
-        assertEquals( false, record.isDisplayAsPercentage() );
-        assertEquals( false, record.isShadow() );
+        assertFalse(record.isHorizontal());
+        assertFalse(record.isStacked());
+        assertFalse(record.isDisplayAsPercentage());
+        assertFalse(record.isShadow());
 
         assertEquals( 10, record.getRecordSize() );
     }
index 948241dbb7a279980e5a4b30eee83e5ae54ab465..68f533361840524a3a599a53f6be501292c53f33 100644 (file)
@@ -45,9 +45,9 @@ public final class TestCategorySeriesAxisRecord extends TestCase {
         assertEquals( 1, record.getLabelFrequency());
         assertEquals( 1, record.getTickMarkFrequency());
         assertEquals( 1, record.getOptions());
-        assertEquals( true, record.isValueAxisCrossing() );
-        assertEquals( false, record.isCrossesFarRight() );
-        assertEquals( false, record.isReversed() );
+        assertTrue(record.isValueAxisCrossing());
+        assertFalse(record.isCrossesFarRight());
+        assertFalse(record.isReversed());
 
         assertEquals( 4 + 8, record.getRecordSize() );
     }
index 93b25ed95bfcfd568d1b149e9da9f2f00b3fbdba..ce2f581b17cce3def28537b3529d3ef9cfced0a8 100644 (file)
@@ -39,10 +39,10 @@ public final class TestDatRecord extends TestCase {
 
         DatRecord record = new DatRecord(TestcaseRecordInputStream.create(0x1063, data));
         assertEquals( 0xD, record.getOptions());
-        assertEquals( true, record.isHorizontalBorder() );
-        assertEquals( false, record.isVerticalBorder() );
-        assertEquals( true, record.isBorder() );
-        assertEquals( true, record.isShowSeriesKey() );
+        assertTrue(record.isHorizontalBorder());
+        assertFalse(record.isVerticalBorder());
+        assertTrue(record.isBorder());
+        assertTrue(record.isShowSeriesKey());
 
         assertEquals( 6, record.getRecordSize() );
     }
index c9958f5074f32322d3934b80844423ac9fbc9577..34a9534ff11abe5d412d31ec66cd2393fa7581d0 100644 (file)
@@ -45,7 +45,7 @@ public final class TestDataFormatRecord extends TestCase {
         assertEquals( 0, record.getSeriesIndex());
         assertEquals( 0, record.getSeriesNumber());
         assertEquals( 0, record.getFormatFlags());
-        assertEquals( false, record.isUseExcel4Colors() );
+        assertFalse(record.isUseExcel4Colors());
 
         assertEquals( 12, record.getRecordSize() );
     }
index da2a8a31891ca8975419da1c53d12f5f4321c438..512b46816d7478ca721fb389472c37c82415bc5f 100644 (file)
@@ -41,8 +41,8 @@ public final class TestFrameRecord extends TestCase {
         FrameRecord record = new FrameRecord(TestcaseRecordInputStream.create(0x1032, data));
         assertEquals( FrameRecord.BORDER_TYPE_REGULAR, record.getBorderType());
         assertEquals( 2, record.getOptions());
-        assertEquals( false, record.isAutoSize() );
-        assertEquals( true, record.isAutoPosition() );
+        assertFalse(record.isAutoSize());
+        assertTrue(record.isAutoPosition());
 
         assertEquals( 8, record.getRecordSize() );
     }
index a23d6741b6cdb20056ab708a0e3629de6b78aec8..3523a0b44b3c5b81830b393559b61bd2a4510733 100644 (file)
@@ -50,12 +50,12 @@ public final class TestLegendRecord extends TestCase {
                assertEquals((byte) 0x1, record.getSpacing());
 
                assertEquals((short) 0x1f, record.getOptions());
-               assertEquals(true, record.isAutoPosition());
-               assertEquals(true, record.isAutoSeries());
-               assertEquals(true, record.isAutoXPositioning());
-               assertEquals(true, record.isAutoYPositioning());
-               assertEquals(true, record.isVertical());
-               assertEquals(false, record.isDataTable());
+        assertTrue(record.isAutoPosition());
+        assertTrue(record.isAutoSeries());
+        assertTrue(record.isAutoXPositioning());
+        assertTrue(record.isAutoYPositioning());
+        assertTrue(record.isVertical());
+        assertFalse(record.isDataTable());
 
                assertEquals(24, record.getRecordSize());
        }
index 5b58b22561e9d0650adb952aa0da43bf0f52759b..f4230cdab36e5fd7a36f1392db4bdcfa5ad97131 100644 (file)
@@ -45,8 +45,8 @@ public final class TestLineFormatRecord extends TestCase {
         assertEquals( 0, record.getLinePattern());
         assertEquals( 0, record.getWeight());
         assertEquals( 1, record.getFormat());
-        assertEquals( true, record.isAuto() );
-        assertEquals( false, record.isDrawTicks() );
+        assertTrue(record.isAuto());
+        assertFalse(record.isDrawTicks());
         assertEquals( 0x4d, record.getColourPaletteIndex());
 
         assertEquals( 16, record.getRecordSize() );
index 3fa87dcc8721df5fd20584bb2eb4294a70c2d34a..02e9483928e4c98a7af1d4f5e63e791183e3ac98 100644 (file)
@@ -162,7 +162,7 @@ recordid = 0x1051, size =8
         assertEquals( LinkedDataRecord.LINK_TYPE_VALUES, record.getLinkType());
         assertEquals( LinkedDataRecord.REFERENCE_TYPE_WORKSHEET, record.getReferenceType());
         assertEquals( 0, record.getOptions());
-        assertEquals( false, record.isCustomNumberFormat() );
+        assertFalse(record.isCustomNumberFormat());
         assertEquals( 0, record.getIndexNumberFmtRecord());
 
         Area3DPtg ptgExpected = new Area3DPtg(0, 7936, 0, 0,
index 9f0f1f1ead9954e74f1dfa99ecb65e98b7317255..9d0c52daee7915fe8863df850ad0203bf8e33aba 100644 (file)
@@ -38,12 +38,12 @@ public final class TestSeriesLabelsRecord extends TestCase {
     public void testLoad() {
         SeriesLabelsRecord record = new SeriesLabelsRecord(TestcaseRecordInputStream.create(0x100c, data));
         assertEquals( 3, record.getFormatFlags());
-        assertEquals( true, record.isShowActual() );
-        assertEquals( true, record.isShowPercent() );
-        assertEquals( false, record.isLabelAsPercentage() );
-        assertEquals( false, record.isSmoothedLine() );
-        assertEquals( false, record.isShowLabel() );
-        assertEquals( false, record.isShowBubbleSizes() );
+        assertTrue(record.isShowActual());
+        assertTrue(record.isShowPercent());
+        assertFalse(record.isLabelAsPercentage());
+        assertFalse(record.isSmoothedLine());
+        assertFalse(record.isShowLabel());
+        assertFalse(record.isShowBubbleSizes());
 
 
         assertEquals( 2+4, record.getRecordSize() );
index ba1415e4db17dcb4a6b338ea2cd7ab7dc8e04210..9c9059f8f5d5d7f8429087cb3ee27ef00a4fa296 100644 (file)
@@ -45,11 +45,11 @@ public final class TestSheetPropertiesRecord extends TestCase {
         }
         assertEquals(0, in.remaining());
         assertEquals( 10, record.getFlags());
-        assertEquals( false, record.isChartTypeManuallyFormatted() );
-        assertEquals( true, record.isPlotVisibleOnly() );
-        assertEquals( false, record.isDoNotSizeWithWindow() );
-        assertEquals( true, record.isDefaultPlotDimensions() );
-        assertEquals( false, record.isAutoPlotArea() );
+        assertFalse(record.isChartTypeManuallyFormatted());
+        assertTrue(record.isPlotVisibleOnly());
+        assertFalse(record.isDoNotSizeWithWindow());
+        assertTrue(record.isDefaultPlotDimensions());
+        assertFalse(record.isAutoPlotArea());
         assertEquals( 0, record.getEmpty());
 
         assertEquals( 8, record.getRecordSize() );
index 4214b0a370e958ac697ef85d259ba72773799d32..cdca0f82b81820ebfe3c0f76ab4eed40ce927250 100644 (file)
@@ -57,19 +57,19 @@ public final class TestTextRecord extends TestCase {
         assertEquals( 0, record.getWidth());
         assertEquals( 0, record.getHeight());
         assertEquals( 177, record.getOptions1());
-        assertEquals( true, record.isAutoColor() );
-        assertEquals( false, record.isShowKey() );
-        assertEquals( false, record.isShowValue() );
-        assertEquals( false, record.isVertical() );
-        assertEquals( true, record.isAutoGeneratedText() );
-        assertEquals( true, record.isGenerated() );
-        assertEquals( false, record.isAutoLabelDeleted() );
-        assertEquals( true, record.isAutoBackground() );
+        assertTrue(record.isAutoColor());
+        assertFalse(record.isShowKey());
+        assertFalse(record.isShowValue());
+        assertFalse(record.isVertical());
+        assertTrue(record.isAutoGeneratedText());
+        assertTrue(record.isGenerated());
+        assertFalse(record.isAutoLabelDeleted());
+        assertTrue(record.isAutoBackground());
         assertEquals(  TextRecord.ROTATION_NONE, record.getRotation() );
-        assertEquals( false, record.isShowCategoryLabelAsPercentage() );
-        assertEquals( false, record.isShowValueAsPercentage() );
-        assertEquals( false, record.isShowBubbleSizes() );
-        assertEquals( false, record.isShowLabel() );
+        assertFalse(record.isShowCategoryLabelAsPercentage());
+        assertFalse(record.isShowValueAsPercentage());
+        assertFalse(record.isShowBubbleSizes());
+        assertFalse(record.isShowLabel());
         assertEquals( 77, record.getIndexOfColorValue());
         assertEquals( 11088, record.getOptions2());
         assertEquals( 0, record.getDataLabelPlacement() );
index 28d13178fc8393d4d9071995e1b1f36c37b8c9c0..0f2b1353bb67083a9130b50bd6317f1dc3018531 100644 (file)
@@ -50,10 +50,10 @@ public final class TestTickRecord extends TestCase {
         assertEquals( (short)0, record.getZero1());
         assertEquals( (short)0, record.getZero2());
         assertEquals( (short)35, record.getOptions());
-        assertEquals( true, record.isAutoTextColor() );
-        assertEquals( true, record.isAutoTextBackground() );
+        assertTrue(record.isAutoTextColor());
+        assertTrue(record.isAutoTextBackground());
         assertEquals( (short)0x0, record.getRotation() );
-        assertEquals( true, record.isAutorotate() );
+        assertTrue(record.isAutorotate());
         assertEquals( (short)77, record.getTickColor());
         assertEquals( (short)0x0, record.getZero3());
 
index d2a08df4a53da9704971fd85f46e0d3349d98284..abd3badc4431081a6eada268380bde45dcfb9c4c 100644 (file)
@@ -49,15 +49,15 @@ public final class TestValueRangeRecord extends TestCase {
         assertEquals( 0.0, record.getMinorIncrement(), 0.001);
         assertEquals( 0.0, record.getCategoryAxisCross(), 0.001);
         assertEquals( 0x011f, record.getOptions());
-        assertEquals( true, record.isAutomaticMinimum() );
-        assertEquals( true, record.isAutomaticMaximum() );
-        assertEquals( true, record.isAutomaticMajor() );
-        assertEquals( true, record.isAutomaticMinor() );
-        assertEquals( true, record.isAutomaticCategoryCrossing() );
-        assertEquals( false, record.isLogarithmicScale() );
-        assertEquals( false, record.isValuesInReverse() );
-        assertEquals( false, record.isCrossCategoryAxisAtMaximum() );
-        assertEquals( true, record.isReserved() );
+        assertTrue(record.isAutomaticMinimum());
+        assertTrue(record.isAutomaticMaximum());
+        assertTrue(record.isAutomaticMajor());
+        assertTrue(record.isAutomaticMinor());
+        assertTrue(record.isAutomaticCategoryCrossing());
+        assertFalse(record.isLogarithmicScale());
+        assertFalse(record.isValuesInReverse());
+        assertFalse(record.isCrossCategoryAxisAtMaximum());
+        assertTrue(record.isReserved());
 
         assertEquals( 42+4, record.getRecordSize() );
     }
index cbeb00223fd1bfcd93848971487a134974e045c0..bd03399c28fe572ef2fe5fc09f1ec439193a8c2b 100644 (file)
@@ -152,8 +152,8 @@ public final class TestCellStyle extends TestCase {
         
         assertEquals(cs1.hashCode(), cs1.hashCode());
         assertEquals(cs2.hashCode(), cs2.hashCode());
-        assertTrue(cs1.equals(cs1));
-        assertTrue(cs2.equals(cs2));
+        assertEquals(cs1, cs1);
+        assertEquals(cs2, cs2);
         
         // Change cs1, hash will alter
         int hash1 = cs1.hashCode();
@@ -238,8 +238,8 @@ public final class TestCellStyle extends TestCase {
         assertEquals(18, orig.getDataFormat());
         
         HSSFCellStyle clone = wb.createCellStyle();
-        assertFalse(HorizontalAlignment.RIGHT == clone.getAlignment());
-        assertFalse(fnt == clone.getFont(wb));
+        assertNotSame(HorizontalAlignment.RIGHT, clone.getAlignment());
+        assertNotSame(fnt, clone.getFont(wb));
         assertFalse(18 == clone.getDataFormat());
         
         clone.cloneStyleFrom(orig);
@@ -280,9 +280,9 @@ public final class TestCellStyle extends TestCase {
         
         HSSFCellStyle clone = wbClone.createCellStyle();
         assertEquals(4, wbClone.getNumberOfFonts());
-        
-        assertFalse(HorizontalAlignment.RIGHT == clone.getAlignment());
-        assertFalse("TestingFont" == clone.getFont(wbClone).getFontName());
+
+        assertNotSame(HorizontalAlignment.RIGHT, clone.getAlignment());
+        assertNotSame("TestingFont", clone.getFont(wbClone).getFontName());
         
         clone.cloneStyleFrom(orig);
         assertEquals(HorizontalAlignment.RIGHT, clone.getAlignment());
@@ -333,9 +333,9 @@ public final class TestCellStyle extends TestCase {
         assertNotNull(wb.getWorkbook().getStyleRecord(22));
         
         // Now check the style names
-        assertEquals(null, cs1.getUserStyleName());
-        assertEquals(null, cs2.getUserStyleName());
-        assertEquals(null, cs3.getUserStyleName());
+        assertNull(cs1.getUserStyleName());
+        assertNull(cs2.getUserStyleName());
+        assertNull(cs3.getUserStyleName());
         assertEquals("style1", cs2.getParentStyle().getUserStyleName());
         assertEquals("style2", cs3.getParentStyle().getUserStyleName());
 
@@ -394,7 +394,7 @@ public final class TestCellStyle extends TestCase {
        HSSFRow r = s.getRow(0);
        HSSFCellStyle cs = r.getCell(0).getCellStyle();
 
-       assertEquals(true, cs.getShrinkToFit());
+        assertTrue(cs.getShrinkToFit());
 
        // New file
        HSSFWorkbook wbOrig = new HSSFWorkbook();
@@ -413,8 +413,8 @@ public final class TestCellStyle extends TestCase {
        wb = HSSFTestDataSamples.writeOutAndReadBack(wbOrig);
        s = wb.getSheetAt(0);
        r = s.getRow(0);
-       assertEquals(false, r.getCell(0).getCellStyle().getShrinkToFit());
-       assertEquals(true,  r.getCell(1).getCellStyle().getShrinkToFit());
+        assertFalse(r.getCell(0).getCellStyle().getShrinkToFit());
+        assertTrue(r.getCell(1).getCellStyle().getShrinkToFit());
     }
     
     
index 13b7895ed28e6737b3365ce405683f6bed415d12..e5ddcaa7f70586c93bd2b73f5953e24b5d7b5104 100644 (file)
@@ -18,6 +18,8 @@
 package org.apache.poi.hssf.usermodel;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -249,12 +251,12 @@ public final class TestDataValidation extends BaseTestDataValidation {
             assertEquals(3, address.getFirstColumn());
             assertEquals(4, address.getLastColumn());
         }
-        assertEquals(true, dv.getEmptyCellAllowed());
-        assertEquals(false, dv.getSuppressDropDownArrow());
-        assertEquals(true, dv.getShowErrorBox());
+        assertTrue(dv.getEmptyCellAllowed());
+        assertFalse(dv.getSuppressDropDownArrow());
+        assertTrue(dv.getShowErrorBox());
         assertEquals("error-title", dv.getErrorBoxTitle());
         assertEquals("error-text", dv.getErrorBoxText());
-        assertEquals(true, dv.getShowPromptBox());
+        assertTrue(dv.getShowPromptBox());
         assertEquals("prompt-title", dv.getPromptBoxTitle());
         assertEquals("prompt-text", dv.getPromptBoxText());
 
@@ -288,8 +290,8 @@ public final class TestDataValidation extends BaseTestDataValidation {
         assertEquals(OperatorType.BETWEEN, c.getOperator());
         assertEquals("A2", c.getFormula1());
         assertEquals("A3", c.getFormula2());
-        assertEquals(null, c.getValue1());
-        assertEquals(null, c.getValue2());
+        assertNull(c.getValue1());
+        assertNull(c.getValue2());
         
         wb.close();
     }
@@ -315,8 +317,8 @@ public final class TestDataValidation extends BaseTestDataValidation {
         DVConstraint c = dv.getConstraint();
         assertEquals(ValidationType.INTEGER, c.getValidationType());
         assertEquals(OperatorType.BETWEEN, c.getOperator());
-        assertEquals(null, c.getFormula1());
-        assertEquals(null, c.getFormula2());
+        assertNull(c.getFormula1());
+        assertNull(c.getFormula2());
         assertEquals(new Double("100"), c.getValue1());
         assertEquals(new Double("200"), c.getValue2());
         
@@ -345,8 +347,8 @@ public final class TestDataValidation extends BaseTestDataValidation {
         assertEquals(ValidationType.DECIMAL, c.getValidationType());
         assertEquals(OperatorType.BETWEEN, c.getOperator());
         assertEquals("A2", c.getFormula1());
-        assertEquals(null, c.getFormula2());
-        assertEquals(null, c.getValue1());
+        assertNull(c.getFormula2());
+        assertNull(c.getValue1());
         assertEquals(new Double("200"), c.getValue2());
         
         wb.close();
@@ -373,10 +375,10 @@ public final class TestDataValidation extends BaseTestDataValidation {
         DVConstraint c = dv.getConstraint();
         assertEquals(ValidationType.DATE, c.getValidationType());
         assertEquals(OperatorType.EQUAL, c.getOperator());
-        assertEquals(null, c.getFormula1());
-        assertEquals(null, c.getFormula2());
+        assertNull(c.getFormula1());
+        assertNull(c.getFormula2());
         assertEquals(DateUtil.getExcelDate(DateUtil.parseYYYYMMDDDate("2014/10/25")), c.getValue1(), 0);
-        assertEquals(null, c.getValue2());
+        assertNull(c.getValue2());
         
         wb.close();
     }
@@ -400,14 +402,14 @@ public final class TestDataValidation extends BaseTestDataValidation {
         assertEquals(1, list.size());
 
         HSSFDataValidation dv = list.get(0);
-        assertEquals(true, dv.getSuppressDropDownArrow());
+        assertTrue(dv.getSuppressDropDownArrow());
 
         DVConstraint c = dv.getConstraint();
         assertEquals(ValidationType.LIST, c.getValidationType());
-        assertEquals(null, c.getFormula1());
-        assertEquals(null, c.getFormula2());
-        assertEquals(null, c.getValue1());
-        assertEquals(null, c.getValue2());
+        assertNull(c.getFormula1());
+        assertNull(c.getFormula2());
+        assertNull(c.getValue1());
+        assertNull(c.getValue2());
         String[] values = c.getExplicitListValues();
         assertEquals(3, values.length);
         assertEquals("aaa", values[0]);
@@ -435,14 +437,14 @@ public final class TestDataValidation extends BaseTestDataValidation {
         assertEquals(1, list.size());
 
         HSSFDataValidation dv = list.get(0);
-        assertEquals(true, dv.getSuppressDropDownArrow());
+        assertTrue(dv.getSuppressDropDownArrow());
 
         DVConstraint c = dv.getConstraint();
         assertEquals(ValidationType.LIST, c.getValidationType());
         assertEquals("A2", c.getFormula1());
-        assertEquals(null, c.getFormula2());
-        assertEquals(null, c.getValue1());
-        assertEquals(null, c.getValue2());
+        assertNull(c.getFormula2());
+        assertNull(c.getValue1());
+        assertNull(c.getValue2());
         
         wb.close();
     }
@@ -467,9 +469,9 @@ public final class TestDataValidation extends BaseTestDataValidation {
         DVConstraint c = dv.getConstraint();
         assertEquals(ValidationType.FORMULA, c.getValidationType());
         assertEquals("A2:A3", c.getFormula1());
-        assertEquals(null, c.getFormula2());
-        assertEquals(null, c.getValue1());
-        assertEquals(null, c.getValue2());
+        assertNull(c.getFormula2());
+        assertNull(c.getValue1());
+        assertNull(c.getValue2());
         wb.close();
     }
 }
index 130e0fd84b5cd56627778e1757e6027e90fc32e9..e765936b01f4c2dc030ecdd8d84d304fcf1971f7 100644 (file)
@@ -140,7 +140,7 @@ public final class TestEscherGraphics2d {
     public void testDraw() {
                graphics.draw(new Line2D.Double(10,10,20,20));
                HSSFSimpleShape s = (HSSFSimpleShape) escherGroup.getChildren().get(0);
-               assertTrue(s.getShapeType() == HSSFSimpleShape.OBJECT_TYPE_LINE);
+        assertEquals(s.getShapeType(), HSSFSimpleShape.OBJECT_TYPE_LINE);
                assertEquals(10, s.getAnchor().getDx1());
                assertEquals(10, s.getAnchor().getDy1());
                assertEquals(20, s.getAnchor().getDx2());
index 60d0ccfdec9d2d0f1f1d8df41aa904a1ea72e17b..61103829aff55c9bba587f61b05f90285edeb64c 100644 (file)
@@ -18,6 +18,7 @@
 package org.apache.poi.hssf.usermodel;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.io.File;
@@ -265,7 +266,7 @@ public final class TestFormulaEvaluatorBugs {
         } catch (NumberFormatException e) {
             fail("Identified bug 44508");
         }
-        assertEquals(true, cell.getBooleanCellValue());
+        assertTrue(cell.getBooleanCellValue());
         
         wb.close();
     }
index 7cd88fe93bc24308a95a9796b22dbf5cb83f50ea..1eea909b3cef836b5f09b212a0cd93af9d294d35 100644 (file)
@@ -18,6 +18,7 @@
 package org.apache.poi.hssf.usermodel;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
@@ -66,7 +67,7 @@ public final class TestFormulas {
         r  = s.getRow(1);
         c  = r.getCell(1);
 
-        assertTrue("Formula is as expected",("1+1".equals(c.getCellFormula())));
+        assertEquals("Formula is as expected", "1+1", c.getCellFormula());
         wb2.close();
     }
 
@@ -209,10 +210,9 @@ public final class TestFormulas {
             for (int y = 1; y < 256 && y > 0; y=(short)(y+2)) {
 
                 HSSFCell c = r.getCell(y);
-                assertTrue("got a formula",c.getCellFormula()!=null);
+                assertNotNull("got a formula", c.getCellFormula());
 
-                assertTrue("loop Formula is as expected "+x+"."+y+operator+y+"."+x+"!="+c.getCellFormula(),(
-                (""+x+"."+y+operator+y+"."+x).equals(c.getCellFormula()) ));
+                assertEquals("loop Formula is as expected " + x + "." + y + operator + y + "." + x + "!=" + c.getCellFormula(), ("" + x + "." + y + operator + y + "." + x), c.getCellFormula());
             }
         }
     }
@@ -316,9 +316,7 @@ public final class TestFormulas {
         r = s.getRow(0);
         c = r.getCell(1);
         //get our minimum values
-        assertTrue("minval Formula is as expected A2"+operator+"A3 != "+c.getCellFormula(),
-        ( ("A2"+operator+"A3").equals(c.getCellFormula())
-        ));
+        assertEquals("minval Formula is as expected A2" + operator + "A3 != " + c.getCellFormula(), ("A2" + operator + "A3"), c.getCellFormula());
 
 
         for (int x = 1; x < Short.MAX_VALUE && x > 0; x=(short)(x*2)) {
@@ -354,10 +352,7 @@ public final class TestFormulas {
                 String ref2=cr.formatAsString();
 
 
-                assertTrue("loop Formula is as expected "+ref+operator+ref2+"!="+c.getCellFormula(),(
-                (""+ref+operator+ref2).equals(c.getCellFormula())
-                                                         )
-                );
+                assertEquals("loop Formula is as expected " + ref + operator + ref2 + "!=" + c.getCellFormula(), ("" + ref + operator + ref2), c.getCellFormula());
             }
         }
 
@@ -391,7 +386,7 @@ public final class TestFormulas {
         //get our minimum values
         r = s.getRow(0);
         c = r.getCell(1);
-        assertTrue("minval Formula is as expected", formula.equals(c.getCellFormula()));
+        assertEquals("minval Formula is as expected", formula, c.getCellFormula());
         wb2.close();
     }
 
@@ -446,9 +441,7 @@ public final class TestFormulas {
         //get our minimum values
         r = s.getRow(0);
         c = r.getCell(1);
-        assertTrue("minval Formula is as expected 1"+operator+"1 != "+c.getCellFormula(),
-        ( ("1"+operator+"1").equals(c.getCellFormula())
-        ));
+        assertEquals("minval Formula is as expected 1" + operator + "1 != " + c.getCellFormula(), ("1" + operator + "1"), c.getCellFormula());
 
         for (int x = 1; x < Short.MAX_VALUE && x > 0; x=(short)(x*2)) {
             r = s.getRow(x);
@@ -457,10 +450,7 @@ public final class TestFormulas {
 
                 c = r.getCell(y);
 
-                assertTrue("loop Formula is as expected "+x+operator+y+"!="+c.getCellFormula(),(
-                (""+x+operator+y).equals(c.getCellFormula())
-                                                         )
-                );
+                assertEquals("loop Formula is as expected " + x + operator + y + "!=" + c.getCellFormula(), ("" + x + operator + y), c.getCellFormula());
             }
         }
 
@@ -468,10 +458,7 @@ public final class TestFormulas {
         r = s.getRow(0);
         c = r.getCell(0);
 
-        assertTrue("maxval Formula is as expected",(
-        (""+Short.MAX_VALUE+operator+Short.MAX_VALUE).equals(c.getCellFormula())
-                                                   )
-        );
+        assertEquals("maxval Formula is as expected", ("" + Short.MAX_VALUE + operator + Short.MAX_VALUE), c.getCellFormula());
     }
 
     /**
@@ -496,9 +483,7 @@ public final class TestFormulas {
         r = s.getRow(0);
         c = r.getCell(0);
 
-        assertTrue("function ="+function+"(A2:A3)",
-                    ( (function+"(A2:A3)").equals((function+"(A2:A3)")) )
-                  );
+        assertEquals("function =" + function + "(A2:A3)", (function + "(A2:A3)"), (function + "(A2:A3)"));
         wb2.close();
     }
 
@@ -524,9 +509,7 @@ public final class TestFormulas {
         r = s.getRow(0);
         c = r.getCell(0);
 
-        assertTrue("function ="+function+"(A2,A3)",
-                    ( (function+"(A2,A3)").equals(c.getCellFormula()) )
-                  );
+        assertEquals("function =" + function + "(A2,A3)", (function + "(A2,A3)"), c.getCellFormula());
         wb2.close();
     }
 
@@ -556,14 +539,10 @@ public final class TestFormulas {
         r = s.getRow(0);
         c = r.getCell(0);
 
-        assertTrue("function ="+function+"(A2:A4,B2:B4)",
-                    ( (function+"(A2:A4,B2:B4)").equals(c.getCellFormula()) )
-                  );
+        assertEquals("function =" + function + "(A2:A4,B2:B4)", (function + "(A2:A4,B2:B4)"), c.getCellFormula());
 
         c=r.getCell(1);
-        assertTrue("function ="+function+"($A$2:$A4,B$2:B4)",
-                    ( (function+"($A$2:$A4,B$2:B4)").equals(c.getCellFormula()) )
-                  );
+        assertEquals("function =" + function + "($A$2:$A4,B$2:B4)", (function + "($A$2:$A4,B$2:B4)"), c.getCellFormula());
         wb2.close();
     }
 
@@ -592,15 +571,15 @@ public final class TestFormulas {
         s = wb2.getSheetAt(0);
         r = s.getRow(0);
         c = r.getCell(0);
-        assertTrue("A3+A2", ("A3+A2").equals(c.getCellFormula()));
+        assertEquals("A3+A2", ("A3+A2"), c.getCellFormula());
          c = r.getCell(1);
-        assertTrue("$A3+$A2", ("$A3+$A2").equals(c.getCellFormula()));
+        assertEquals("$A3+$A2", ("$A3+$A2"), c.getCellFormula());
          c = r.getCell(2);
-        assertTrue("A$3+A$2", ("A$3+A$2").equals(c.getCellFormula()));
+        assertEquals("A$3+A$2", ("A$3+A$2"), c.getCellFormula());
          c = r.getCell(3);
-        assertTrue("$A$3+$A$2", ("$A$3+$A$2").equals(c.getCellFormula()));
+        assertEquals("$A$3+$A$2", ("$A$3+$A$2"), c.getCellFormula());
          c = r.getCell(4);
-        assertTrue("SUM($A$3,$A$2)", ("SUM($A$3,$A$2)").equals(c.getCellFormula()));
+        assertEquals("SUM($A$3,$A$2)", ("SUM($A$3,$A$2)"), c.getCellFormula());
         wb2.close();
     }
 
@@ -626,9 +605,9 @@ public final class TestFormulas {
         s = wb2.getSheet("B");
         r = s.getRow(0);
         c = r.getCell(0);
-        assertTrue("expected: AVERAGE(A!A1:B1) got: "+c.getCellFormula(), ("AVERAGE(A!A1:B1)").equals(c.getCellFormula()));
+        assertEquals("expected: AVERAGE(A!A1:B1) got: " + c.getCellFormula(), ("AVERAGE(A!A1:B1)"), c.getCellFormula());
         c = r.getCell(1);
-        assertTrue("expected: A!A1+A!B1 got: "+c.getCellFormula(), ("A!A1+A!B1").equals(c.getCellFormula()));
+        assertEquals("expected: A!A1+A!B1 got: " + c.getCellFormula(), ("A!A1+A!B1"), c.getCellFormula());
         wb2.close();
     }
 
@@ -760,14 +739,14 @@ public final class TestFormulas {
         r = s.getRow(0);
         c = r.getCell(4);
 
-        assertTrue("expected: IF(A1=D1,\"A1\",\"B1\") got "+c.getCellFormula(), ("IF(A1=D1,\"A1\",\"B1\")").equals(c.getCellFormula()));
+        assertEquals("expected: IF(A1=D1,\"A1\",\"B1\") got " + c.getCellFormula(), ("IF(A1=D1,\"A1\",\"B1\")"), c.getCellFormula());
         wb2.close();
 
         wb1 = openSample("IfFormulaTest.xls");
         s = wb1.getSheetAt(0);
         r = s.getRow(3);
         c = r.getCell(0);
-        assertTrue("expected: IF(A3=A1,\"A1\",\"A2\") got "+c.getCellFormula(), ("IF(A3=A1,\"A1\",\"A2\")").equals(c.getCellFormula()));
+        assertEquals("expected: IF(A3=A1,\"A1\",\"A2\") got " + c.getCellFormula(), ("IF(A3=A1,\"A1\",\"A2\")"), c.getCellFormula());
         //c = r.getCell((short)1);
         //assertTrue("expected: A!A1+A!B1 got: "+c.getCellFormula(), ("A!A1+A!B1").equals(c.getCellFormula()));
         wb1.close();
index aac0747579cdb6d651ed485e87203fc157926aaf..f6e5afbd817c97646ca5ac541e6290ae0c6ad570 100644 (file)
@@ -20,6 +20,7 @@ package org.apache.poi.hssf.usermodel;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 
@@ -377,7 +378,7 @@ public final class TestHSSFCell extends BaseTestCell {
                if (isPresent) {
                        assertEquals(StringRecord.class, recs[index++].getClass());
                } else {
-                       assertFalse(StringRecord.class == recs[index].getClass());
+            assertNotSame(StringRecord.class, recs[index].getClass());
                }
                Record dbcr = recs[index];
                assertEquals(DBCellRecord.class, dbcr.getClass());
index 74e77650561d666e2e345caf2f16988784853999..62ecf00a4fee5a38ae355a584f7d1a58610be928 100644 (file)
@@ -19,8 +19,10 @@ package org.apache.poi.hssf.usermodel;
 import static org.apache.poi.poifs.storage.RawDataUtil.decompress;
 import static org.junit.Assert.assertArrayEquals;
 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 java.io.IOException;
 
@@ -332,7 +334,7 @@ public final class TestHSSFComment extends BaseTestCellComment {
         assertEquals(comment.getRow(), 4);
 
         comment.setVisible(false);
-        assertEquals(comment.isVisible(), false);
+        assertFalse(comment.isVisible());
 
         HSSFWorkbook wbBack = HSSFTestDataSamples.writeOutAndReadBack(wb);
         sh = wbBack.getSheetAt(0);
@@ -344,7 +346,7 @@ public final class TestHSSFComment extends BaseTestCellComment {
         assertEquals("poi", comment.getAuthor());
         assertEquals(comment.getColumn(), 3);
         assertEquals(comment.getRow(), 4);
-        assertEquals(comment.isVisible(), false);
+        assertFalse(comment.isVisible());
 
         comment.setString(new HSSFRichTextString("comment12"));
         comment.setAuthor("poi2");
@@ -361,7 +363,7 @@ public final class TestHSSFComment extends BaseTestCellComment {
         assertEquals("poi2", comment.getAuthor());
         assertEquals(comment.getColumn(), 32);
         assertEquals(comment.getRow(), 42);
-        assertEquals(comment.isVisible(), true);
+        assertTrue(comment.isVisible());
         
         wb.close();
         wbBack.close();
index ed72f82a8f70d0125f419ccd08d986aaeabe4af8..7ee4525989dbc584afcd26111aa51d35b011a3f6 100644 (file)
@@ -18,6 +18,7 @@
 package org.apache.poi.hssf.usermodel;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.text.DecimalFormat;
@@ -240,7 +241,7 @@ public final class TestHSSFDataFormatter {
 
             // should not be equal to "555.555"
             assertTrue( DateUtil.isCellDateFormatted(cell) );
-            assertTrue( ! "555.555".equals(fmtval));
+            assertFalse("555.555".equals(fmtval));
 
             String fmt = cell.getCellStyle().getDataFormatString();
 
@@ -270,7 +271,7 @@ public final class TestHSSFDataFormatter {
 
             // should not be equal to "555.47431"
             assertTrue( DateUtil.isCellDateFormatted(cell) );
-            assertTrue( ! "555.47431".equals(fmtval));
+            assertFalse("555.47431".equals(fmtval));
 
             // check we found the time properly
             assertTrue("Format came out incorrect - " + fmt + " - found " + fmtval + 
index 9338dfa652bafd62d43083d256a0dee363693ba6..758b0fe10ff7a3b43b6bf7f08d2add8d07c6a099 100644 (file)
@@ -107,7 +107,7 @@ public final class TestHSSFPalette {
         assertEquals(FillPatternType.NO_FILL, cellA.getCellStyle().getFillPattern());
         assertEquals(FillPatternType.NO_FILL, cellA.getCellStyle().getFillPatternEnum());
         assertEquals("0:0:0", p.getColor((short)64).getHexString());
-        assertEquals(null, p.getColor((short)32767));
+        assertNull(p.getColor((short) 32767));
 
         // Red
         assertEquals("I'm red", cellB.getStringCellValue());
index 7b88fbc6502f7d354925cd20add7b11dad0c6f70..9a87b3fe7f276b8d0ebfd214b5e5ae352ef69273 100644 (file)
@@ -18,6 +18,7 @@
 package org.apache.poi.poifs.eventfilesystem;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.util.HashSet;
@@ -67,7 +68,7 @@ public final class TestPOIFSReaderRegistry {
                 Iterator<POIFSReaderListener> listeners =
                     registry.getListeners(path, name).iterator();
 
-                assertTrue(!listeners.hasNext());
+                assertFalse(listeners.hasNext());
             }
         }
     }
@@ -102,7 +103,7 @@ public final class TestPOIFSReaderRegistry {
 
                 if (k == n)
                 {
-                    assertTrue(!listeners.iterator().hasNext());
+                    assertFalse(listeners.iterator().hasNext());
                 }
                 else
                 {
@@ -118,8 +119,8 @@ public final class TestPOIFSReaderRegistry {
                     {
                         if (j == k)
                         {
-                            assertTrue(!registeredListeners
-                                .contains(this.listeners[ j ]));
+                            assertFalse(registeredListeners
+                                    .contains(this.listeners[j]));
                         }
                         else
                         {
index 41d1a340f0c93f2f3f8d3f2f16d79d5abe1e6c3c..366bc4387e67458f671e178b698de71568849288 100644 (file)
@@ -86,7 +86,7 @@ public final class TestDirectoryNode extends TestCase {
         assertEquals(property2.getName(), node.getName());
 
         // verify behavior of isDocumentEntry
-        assertTrue(!node.isDocumentEntry());
+        assertFalse(node.isDocumentEntry());
 
         // verify behavior of getParent
         assertEquals(parent, node.getParent());
@@ -117,7 +117,7 @@ public final class TestDirectoryNode extends TestCase {
         assertEquals(2, count);
 
         // verify behavior of isEmpty
-        assertTrue(!node.isEmpty());
+        assertFalse(node.isEmpty());
 
         // verify behavior of getEntryCount
         assertEquals(2, node.getEntryCount());
@@ -145,7 +145,7 @@ public final class TestDirectoryNode extends TestCase {
         assertEquals(property1.getName(), node.getName());
 
         // verify behavior of isDocumentEntry
-        assertTrue(!node.isDocumentEntry());
+        assertFalse(node.isDocumentEntry());
 
         // verify behavior of getParent
         assertNull(node.getParent());
@@ -202,14 +202,14 @@ public final class TestDirectoryNode extends TestCase {
         DirectoryEntry  root = fs.getRoot();
 
         // verify cannot rename the root directory
-        assertTrue(!root.renameTo("foo"));
+        assertFalse(root.renameTo("foo"));
         DirectoryEntry dir = fs.createDirectory("myDir");
 
         assertTrue(dir.renameTo("foo"));
         assertEquals("foo", dir.getName());
         DirectoryEntry dir2 = fs.createDirectory("myDir");
 
-        assertTrue(!dir2.renameTo("foo"));
+        assertFalse(dir2.renameTo("foo"));
         assertEquals("myDir", dir2.getName());
         assertTrue(dir.renameTo("FirstDir"));
         assertTrue(dir2.renameTo("foo"));
index 9b69b1a2cb883872f57ee75c65657e769462bdb4..8a6e7da480d12b67b58e67f210fef2388be2d060 100644 (file)
@@ -60,8 +60,7 @@ public final class TestDocumentDescriptor extends TestCase {
                         }
                         else
                         {
-                            assertTrue("" + j + "," + k + "," + m + "," + n,
-                                       !d1.equals(d2));
+                            assertFalse(d1.equals(d2));
                         }
                     }
                 }
@@ -126,8 +125,7 @@ public final class TestDocumentDescriptor extends TestCase {
                         }
                         else
                         {
-                            assertTrue("" + j + "," + k + "," + m + "," + n,
-                                       !(d1.equals(d2)));
+                            assertFalse(d1.equals(d2));
                         }
                     }
                 }
@@ -165,8 +163,7 @@ public final class TestDocumentDescriptor extends TestCase {
                             new DocumentDescriptor(builtUpPaths[ k ],
                                                    names[ n ]);
 
-                        assertTrue("" + j + "," + k + "," + m + "," + n,
-                                   !(d1.equals(d2)));
+                        assertFalse(d1.equals(d2));
                     }
                 }
             }
index 9494fcfcc6904be81dae1c0bc1ac412b3628fb84..b1fa580f75d3f2f921f26db8e24612cf488a5c37 100644 (file)
@@ -59,20 +59,20 @@ public final class TestFilteringDirectoryNode {
       assertEquals(3, d.getEntryCount());
       assertEquals(dirA.getName(), d.getEntry(dirA.getName()).getName());
 
-      assertEquals(true, d.getEntry(dirA.getName()).isDirectoryEntry());
-      assertEquals(false, d.getEntry(dirA.getName()).isDocumentEntry());
+       assertTrue(d.getEntry(dirA.getName()).isDirectoryEntry());
+       assertFalse(d.getEntry(dirA.getName()).isDocumentEntry());
 
-      assertEquals(true, d.getEntry(dirB.getName()).isDirectoryEntry());
-      assertEquals(false, d.getEntry(dirB.getName()).isDocumentEntry());
+       assertTrue(d.getEntry(dirB.getName()).isDirectoryEntry());
+       assertFalse(d.getEntry(dirB.getName()).isDocumentEntry());
 
-      assertEquals(false, d.getEntry(eRoot.getName()).isDirectoryEntry());
-      assertEquals(true, d.getEntry(eRoot.getName()).isDocumentEntry());
+       assertFalse(d.getEntry(eRoot.getName()).isDirectoryEntry());
+       assertTrue(d.getEntry(eRoot.getName()).isDocumentEntry());
 
       Iterator<Entry> i = d.getEntries();
       assertEquals(dirA, i.next());
       assertEquals(dirB, i.next());
       assertEquals(eRoot, i.next());
-      assertEquals(null, i.next());
+       assertNull(i.next());
    }
 
    @Test
@@ -81,9 +81,9 @@ public final class TestFilteringDirectoryNode {
       FilteringDirectoryNode d = new FilteringDirectoryNode(fs.getRoot(), excl);
 
       assertEquals(2, d.getEntryCount());
-      assertEquals(true, d.hasEntry(dirA.getName()));
-      assertEquals(true, d.hasEntry(dirB.getName()));
-      assertEquals(false, d.hasEntry(eRoot.getName()));
+       assertTrue(d.hasEntry(dirA.getName()));
+       assertTrue(d.hasEntry(dirB.getName()));
+       assertFalse(d.hasEntry(eRoot.getName()));
 
       assertEquals(dirA, d.getEntry(dirA.getName()));
       assertEquals(dirB, d.getEntry(dirB.getName()));
@@ -96,7 +96,7 @@ public final class TestFilteringDirectoryNode {
       Iterator<Entry> i = d.getEntries();
       assertEquals(dirA, i.next());
       assertEquals(dirB, i.next());
-      assertEquals(null, i.next());
+       assertNull(i.next());
 
 
       // Filter more
@@ -104,9 +104,9 @@ public final class TestFilteringDirectoryNode {
       d = new FilteringDirectoryNode(fs.getRoot(), excl);
 
       assertEquals(1, d.getEntryCount());
-      assertEquals(false, d.hasEntry(dirA.getName()));
-      assertEquals(true, d.hasEntry(dirB.getName()));
-      assertEquals(false, d.hasEntry(eRoot.getName()));
+       assertFalse(d.hasEntry(dirA.getName()));
+       assertTrue(d.hasEntry(dirB.getName()));
+       assertFalse(d.hasEntry(eRoot.getName()));
 
       try {
          d.getEntry(dirA.getName());
@@ -122,7 +122,7 @@ public final class TestFilteringDirectoryNode {
 
       i = d.getEntries();
       assertEquals(dirB, i.next());
-      assertEquals(null, i.next());
+       assertNull(i.next());
 
 
       // Filter everything
@@ -130,9 +130,9 @@ public final class TestFilteringDirectoryNode {
       d = new FilteringDirectoryNode(fs.getRoot(), excl);
 
       assertEquals(0, d.getEntryCount());
-      assertEquals(false, d.hasEntry(dirA.getName()));
-      assertEquals(false, d.hasEntry(dirB.getName()));
-      assertEquals(false, d.hasEntry(eRoot.getName()));
+       assertFalse(d.hasEntry(dirA.getName()));
+       assertFalse(d.hasEntry(dirB.getName()));
+       assertFalse(d.hasEntry(eRoot.getName()));
 
       try {
          d.getEntry(dirA.getName());
@@ -151,7 +151,7 @@ public final class TestFilteringDirectoryNode {
       }
 
       i = d.getEntries();
-      assertEquals(null, i.next());
+       assertNull(i.next());
    }
 
    @Test
@@ -166,20 +166,20 @@ public final class TestFilteringDirectoryNode {
 
       // Check main
       assertEquals(2, d.getEntryCount());
-      assertEquals(true, d.hasEntry(dirA.getName()));
-      assertEquals(true, d.hasEntry(dirB.getName()));
-      assertEquals(false, d.hasEntry(eRoot.getName()));
+       assertTrue(d.hasEntry(dirA.getName()));
+       assertTrue(d.hasEntry(dirB.getName()));
+       assertFalse(d.hasEntry(eRoot.getName()));
 
       // Check filtering down
-      assertEquals(true, d.getEntry(dirA.getName()) instanceof FilteringDirectoryNode);
-      assertEquals(false, d.getEntry(dirB.getName()) instanceof FilteringDirectoryNode);
+       assertTrue(d.getEntry(dirA.getName()) instanceof FilteringDirectoryNode);
+       assertFalse(d.getEntry(dirB.getName()) instanceof FilteringDirectoryNode);
 
       DirectoryEntry fdA = (DirectoryEntry) d.getEntry(dirA.getName());
-      assertEquals(false, fdA.hasEntry(eA.getName()));
-      assertEquals(true, fdA.hasEntry(dirAA.getName()));
+       assertFalse(fdA.hasEntry(eA.getName()));
+       assertTrue(fdA.hasEntry(dirAA.getName()));
 
       DirectoryEntry fdAA = (DirectoryEntry) fdA.getEntry(dirAA.getName());
-      assertEquals(true, fdAA.hasEntry(eAA.getName()));
+       assertTrue(fdAA.hasEntry(eAA.getName()));
    }
 
    @Test(expected = IllegalArgumentException.class)
index aec1f20d6e95d99743a138011f9ed3377c415300..cc91dd602a161a9674172597c6dcad54c7d5b0ba 100644 (file)
@@ -271,8 +271,7 @@ public final class TestPOIFSDocumentPath extends TestCase {
                 }
                 else
                 {
-                    assertTrue(j + "<>" + k,
-                               !(fullPaths[ j ].equals(builtUpPaths[ k ])));
+                    assertFalse(fullPaths[j].equals(builtUpPaths[k]));
                 }
             }
         }
@@ -297,8 +296,7 @@ public final class TestPOIFSDocumentPath extends TestCase {
         {
             for (int j = 0; j < badPaths.length; j++)
             {
-                assertTrue(j + "<>" + k,
-                           !(fullPaths[ k ].equals(badPaths[ j ])));
+                assertFalse(fullPaths[k].equals(badPaths[j]));
             }
         }
     }
index 2d94aba13a7c0bd3d1bb0c1e5fac3a9c5a682b26..c14c5dd17fb04e63239819b917c92210f528979a 100644 (file)
@@ -18,6 +18,7 @@
 package org.apache.poi.poifs.property;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -129,8 +130,7 @@ public final class TestDirectoryProperty {
 
                     if (index != -1)
                     {
-                        assertTrue("found index " + index + " twice",
-                                   !found[ index - 1 ]);
+                        assertFalse(found[index - 1]);
                         found[ index - 1 ] = true;
                         total_found++;
                     }
@@ -143,8 +143,7 @@ public final class TestDirectoryProperty {
 
                     if (index != -1)
                     {
-                        assertTrue("found index " + index + " twice",
-                                   !found[ index - 1 ]);
+                        assertFalse(found[index - 1]);
                         found[ index - 1 ] = true;
                         total_found++;
                     }
@@ -246,7 +245,7 @@ public final class TestDirectoryProperty {
             // as expected
         }
         assertTrue(_property.deleteChild(p1));
-        assertTrue(!_property.deleteChild(p1));
+        assertFalse(_property.deleteChild(p1));
         _property.addChild(new LocalProperty(1));
     }
 
@@ -259,12 +258,12 @@ public final class TestDirectoryProperty {
         _property.addChild(p1);
         assertTrue(_property.changeName(p1, "foobar"));
         assertEquals("foobar", p1.getName());
-        assertTrue(!_property.changeName(p1, "foobar"));
+        assertFalse(_property.changeName(p1, "foobar"));
         assertEquals("foobar", p1.getName());
         Property p2 = new LocalProperty(1);
 
         _property.addChild(p2);
-        assertTrue(!_property.changeName(p1, originalName));
+        assertFalse(_property.changeName(p1, originalName));
         assertTrue(_property.changeName(p2, "foo"));
         assertTrue(_property.changeName(p1, originalName));
     }
@@ -299,6 +298,6 @@ public final class TestDirectoryProperty {
         }
         assertEquals(index, property.getIndex());
         assertEquals(name, property.getName());
-        assertTrue(!property.getChildren().hasNext());
+        assertFalse(property.getChildren().hasNext());
     }
 }
index d4442e859a9fd9da413ab4b59d663bae97aceaf2..61b230d4ff70b25a4c371f845e3f5dc4776dd65f 100644 (file)
@@ -100,7 +100,7 @@ public final class TestDocumentProperty extends TestCase {
 
         if (size >= 4096)
         {
-            assertTrue(!property.shouldUseSmallBlocks());
+            assertFalse(property.shouldUseSmallBlocks());
         }
         else
         {
index 27708a4b61b0e8a8734caffc5f9099519cc2ad52..5553bb7b1008b851dfcf80f52bd85168298cd389 100644 (file)
@@ -18,6 +18,7 @@
 package org.apache.poi.poifs.property;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.io.ByteArrayOutputStream;
@@ -131,7 +132,7 @@ public final class TestRootProperty {
                }
                assertEquals(index, property.getIndex());
                assertEquals(name, property.getName());
-               assertTrue(!property.getChildren().hasNext());
+        assertFalse(property.getChildren().hasNext());
                assertEquals(property.getStorageClsid().toString(), sClsId);
        }
 }
index 371188edb67dd01c374c17b1c153268e2441d4fb..fe7b087c2c3fa67b955c4f0dfcbd0a5eaea29fe0 100644 (file)
@@ -20,6 +20,7 @@ package org.apache.poi.sl.draw.geom;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
 import java.awt.geom.Path2D;
@@ -52,7 +53,7 @@ public class TestPresetGeometries {
         }
         
         // we get the same instance on further calls
-        assertTrue(shapes == PresetGeometries.getInstance());
+        assertSame(shapes, PresetGeometries.getInstance());
     }
 
     // helper methods to adjust list of presets for other tests
index e2e8fc9e45a5b20b39dc23faa3cb94c1cc5522c1..d71d955bbc60a76b7cdd6dbfc577017813315aa0 100644 (file)
@@ -17,6 +17,7 @@
 package org.apache.poi.ss.formula;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -150,12 +151,12 @@ public abstract class BaseTestExternalFunctions {
 
         Cell cell2 = sh.getRow(2).getCell(1);
         assertEquals("ISODD(2)", cell2.getCellFormula());
-        assertEquals(false, evaluator.evaluate(cell2).getBooleanValue());
+        assertFalse(evaluator.evaluate(cell2).getBooleanValue());
         assertEquals(CellType.BOOLEAN, evaluator.evaluateFormulaCell(cell2));
 
         Cell cell3 = sh.getRow(3).getCell(1);
         assertEquals("ISEVEN(2)", cell3.getCellFormula());
-        assertEquals(true, evaluator.evaluate(cell3).getBooleanValue());
+        assertTrue(evaluator.evaluate(cell3).getBooleanValue());
         assertEquals(CellType.BOOLEAN, evaluator.evaluateFormulaCell(cell3));
 
         wb.close();
index e40100d5b963499bdc67dac084987115b219c386..1abe548430d7dc39f4728f1d9b683eb580c8ac31 100644 (file)
@@ -45,7 +45,7 @@ public class TestPlainCellCache extends TestCase {
 
                         Loc sameLoc = new Loc(bookIndex, sheetIndex, rowIndex, columnIndex);
                         assertEquals(loc.hashCode(), sameLoc.hashCode());
-                        assertTrue(loc.equals(sameLoc));
+                        assertEquals(loc, sameLoc);
 
                         assertNull(cache.get(loc));
                         PlainValueCellCacheEntry entry = new PlainValueCellCacheEntry(new NumberEval(0));
index 4c0223afd7f05c0562b3197c13f62e544a045c94..21fdce4bfd75aa90ebd9a64266477906a28b3c26 100644 (file)
@@ -18,6 +18,7 @@ package org.apache.poi.ss.formula.eval;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
@@ -66,7 +67,7 @@ public abstract class BaseTestCircularReferences {
      * Makes sure that the specified evaluated cell value represents a circular reference error.
      */
     private static void confirmCycleErrorCode(CellValue cellValue) {
-        assertTrue(cellValue.getCellType() == CellType.ERROR);
+        assertSame(cellValue.getCellType(), CellType.ERROR);
         assertEquals(ErrorEval.CIRCULAR_REF_ERROR.getErrorCode(), cellValue.getErrorValue());
     }
 
@@ -96,7 +97,7 @@ public abstract class BaseTestCircularReferences {
 
         CellValue cellValue = evaluateWithCycles(wb, testCell);
 
-        assertTrue(cellValue.getCellType() == CellType.NUMERIC);
+        assertSame(cellValue.getCellType(), CellType.NUMERIC);
         assertEquals(2, cellValue.getNumberValue(), 0);
         wb.close();
     }
index 565f756d081037c3b34785e2f86ba649e13d86db..db2a20c1e284d18a83309888f6e1c12c8b2450a2 100644 (file)
@@ -26,6 +26,7 @@ import java.io.IOException;
 import java.io.InputStream;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 /**
@@ -111,7 +112,7 @@ public final class TestFormulaBugs {
                
                cv = fe.evaluate(row.getCell(1));
                assertEquals(CellType.BOOLEAN, cv.getCellType());
-               assertEquals(true, cv.getBooleanValue());
+        assertTrue(cv.getBooleanValue());
                
                wb.close();
        }
index 29d82c1e5b4fa732d0a1de3ab84b54f492cf4237..5d142c8ec60d774eec81975c08799365afea84f5 100644 (file)
@@ -18,6 +18,7 @@
 package org.apache.poi.ss.formula.functions;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import org.apache.poi.hssf.usermodel.HSSFCell;
 import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator;
@@ -51,12 +52,12 @@ public final class TestIsBlank {
         HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb);
         CellValue result = fe.evaluate(cell);
         assertEquals(CellType.BOOLEAN, result.getCellType());
-        assertEquals(true, result.getBooleanValue());
+        assertTrue(result.getBooleanValue());
 
         cell.setCellFormula("isblank(D7:D7)");
 
         result = fe.evaluate(cell);
         assertEquals(CellType.BOOLEAN, result.getCellType());
-        assertEquals(true, result.getBooleanValue());
+        assertTrue(result.getBooleanValue());
     }
 }
index a099b7ff44cfc7b816c62696715ec963d3f4fb23..a89a2130918f7c848b7f0830150f1b9daadf45ab 100644 (file)
@@ -76,7 +76,7 @@ public final class TestTFunc {
 
        private static void confirmError(ValueEval arg) {
                ValueEval eval = invokeT(arg);
-               assertSame(arg, eval);
+        assertSame(arg, eval);
        }
 
        @Test
@@ -119,7 +119,7 @@ public final class TestTFunc {
                confirmString(eval, "");
 
                eval = invokeTWithReference(ErrorEval.NAME_INVALID);
-               assertSame(eval, ErrorEval.NAME_INVALID);
+        assertSame(eval, ErrorEval.NAME_INVALID);
        }
 
        @Test
index f19f1ac5626476174e8f3685a25a4e08e310b009..852c98900985a14790b33a9d63a0194e75f4d13e 100644 (file)
@@ -169,8 +169,7 @@ public abstract class BaseTestCellComment {
             assertNotNull("Cells in the second column have comments", sheet.getCellComment(new CellAddress(rownum, 1)));
 
             assertEquals("Yegor Kozlov", comment.getAuthor());
-            assertTrue("cells in the second column should have non-empty notes",
-                    !comment.getString().getString().isEmpty());
+            assertFalse(comment.getString().getString().isEmpty());
             assertEquals(rownum, comment.getRow());
             assertEquals(cell.getColumnIndex(), comment.getColumn());
         }
index 0b7aef693eac85a53144472155b0c25c5ce42c6d..b0944ee27ee666458324bfa1d6163375e2f3ff1a 100644 (file)
@@ -23,6 +23,7 @@ import org.junit.Test;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import org.apache.poi.ss.usermodel.helpers.ColumnShifter;
 
@@ -77,7 +78,7 @@ public abstract class BaseTestColumnShifting {
     public void testShiftLeft() {
         try {
             columnShifter.shiftColumns(1, 2, -3);
-            assertTrue("Shift to negative indices should throw exception", false);
+            fail("Shift to negative indices should throw exception");
         }
         catch(IllegalStateException e){
             assertTrue(true);
index 6bdeccddf780304f891a072c88d51cc2de8564e4..0399c964ed086a10b44dddce9a63c0fb4cc33002 100644 (file)
@@ -610,7 +610,7 @@ public abstract class BaseTestConditionalFormatting {
         assertEquals(ConditionType.CELL_VALUE_IS, cr.getConditionType());
         assertEquals(ComparisonOperator.GT, cr.getComparisonOperation());
         assertEquals("0", cr.getFormula1());
-        assertEquals(null, cr.getFormula2());
+        assertNull(cr.getFormula2());
         // When it matches:
         //   Sets the font colour to dark green
         //   Sets the background colour to lighter green
@@ -791,13 +791,13 @@ public abstract class BaseTestConditionalFormatting {
     private void assertDataBar(ConditionalFormattingRule cr, String color) {
         assertEquals(ConditionType.DATA_BAR, cr.getConditionType());
         assertEquals(ComparisonOperator.NO_COMPARISON, cr.getComparisonOperation());
-        assertEquals(null, cr.getFormula1());
-        assertEquals(null, cr.getFormula2());
+        assertNull(cr.getFormula1());
+        assertNull(cr.getFormula2());
         
         DataBarFormatting databar = cr.getDataBarFormatting();
         assertNotNull(databar);
-        assertEquals(false, databar.isIconOnly());
-        assertEquals(true, databar.isLeftToRight());
+        assertFalse(databar.isIconOnly());
+        assertTrue(databar.isLeftToRight());
         assertEquals(0, databar.getWidthMin());
         assertEquals(100, databar.getWidthMax());
         
@@ -806,12 +806,12 @@ public abstract class BaseTestConditionalFormatting {
         ConditionalFormattingThreshold th;
         th = databar.getMinThreshold();
         assertEquals(RangeType.MIN, th.getRangeType());
-        assertEquals(null, th.getValue());
-        assertEquals(null, th.getFormula());
+        assertNull(th.getValue());
+        assertNull(th.getFormula());
         th = databar.getMaxThreshold();
         assertEquals(RangeType.MAX, th.getRangeType());
-        assertEquals(null, th.getValue());
-        assertEquals(null, th.getFormula());
+        assertNull(th.getValue());
+        assertNull(th.getFormula());
     }
     
     private void assertIconSetPercentages(ConditionalFormatting cf, IconSet iconset, Double...vals) {
@@ -822,14 +822,14 @@ public abstract class BaseTestConditionalFormatting {
     private void assertIconSetPercentages(ConditionalFormattingRule cr, IconSet iconset, Double...vals) {
         assertEquals(ConditionType.ICON_SET, cr.getConditionType());
         assertEquals(ComparisonOperator.NO_COMPARISON, cr.getComparisonOperation());
-        assertEquals(null, cr.getFormula1());
-        assertEquals(null, cr.getFormula2());
+        assertNull(cr.getFormula1());
+        assertNull(cr.getFormula2());
         
         IconMultiStateFormatting icon = cr.getMultiStateFormatting();
         assertNotNull(icon);
         assertEquals(iconset, icon.getIconSet());
-        assertEquals(false, icon.isIconOnly());
-        assertEquals(false, icon.isReversed());
+        assertFalse(icon.isIconOnly());
+        assertFalse(icon.isReversed());
         
         assertNotNull(icon.getThresholds());
         assertEquals(vals.length, icon.getThresholds().length);
@@ -838,7 +838,7 @@ public abstract class BaseTestConditionalFormatting {
             ConditionalFormattingThreshold th = icon.getThresholds()[i];
             assertEquals(RangeType.PERCENT, th.getRangeType());
             assertEquals(v, th.getValue());
-            assertEquals(null, th.getFormula());
+            assertNull(th.getFormula());
         }
     }
     
@@ -850,8 +850,8 @@ public abstract class BaseTestConditionalFormatting {
     private void assertColorScale(ConditionalFormattingRule cr, String... colors) {
         assertEquals(ConditionType.COLOR_SCALE, cr.getConditionType());
         assertEquals(ComparisonOperator.NO_COMPARISON, cr.getComparisonOperation());
-        assertEquals(null, cr.getFormula1());
-        assertEquals(null, cr.getFormula2());
+        assertNull(cr.getFormula1());
+        assertNull(cr.getFormula2());
         
         ColorScaleFormatting color = cr.getColorScaleFormatting();
         assertNotNull(color);
@@ -873,7 +873,7 @@ public abstract class BaseTestConditionalFormatting {
                 assertEquals(RangeType.PERCENTILE, th.getRangeType());
                 assertEquals(steps*i, th.getValue().intValue());
             }
-            assertEquals(null, th.getFormula());
+            assertNull(th.getFormula());
         }
         
         // Colors should match
@@ -1107,8 +1107,8 @@ public abstract class BaseTestConditionalFormatting {
         
         assertEquals(IconSet.GYRB_4_TRAFFIC_LIGHTS, iconFmt.getIconSet());
         assertEquals(4, iconFmt.getThresholds().length);
-        assertEquals(false, iconFmt.isIconOnly());
-        assertEquals(false, iconFmt.isReversed());
+        assertFalse(iconFmt.isIconOnly());
+        assertFalse(iconFmt.isReversed());
         
         iconFmt.setIconOnly(true);
         iconFmt.getThresholds()[0].setRangeType(RangeType.MIN);
@@ -1136,17 +1136,17 @@ public abstract class BaseTestConditionalFormatting {
         
         assertEquals(IconSet.GYRB_4_TRAFFIC_LIGHTS, iconFmt.getIconSet());
         assertEquals(4, iconFmt.getThresholds().length);
-        assertEquals(true, iconFmt.isIconOnly());
-        assertEquals(false, iconFmt.isReversed());
+        assertTrue(iconFmt.isIconOnly());
+        assertFalse(iconFmt.isReversed());
 
         assertEquals(RangeType.MIN,    iconFmt.getThresholds()[0].getRangeType());
         assertEquals(RangeType.NUMBER, iconFmt.getThresholds()[1].getRangeType());
         assertEquals(RangeType.PERCENT,iconFmt.getThresholds()[2].getRangeType());
         assertEquals(RangeType.MAX,    iconFmt.getThresholds()[3].getRangeType());
-        assertEquals(null, iconFmt.getThresholds()[0].getValue());
+        assertNull(iconFmt.getThresholds()[0].getValue());
         assertEquals(10d,  iconFmt.getThresholds()[1].getValue(), 0);
         assertEquals(75d,  iconFmt.getThresholds()[2].getValue(), 0);
-        assertEquals(null, iconFmt.getThresholds()[3].getValue());
+        assertNull(iconFmt.getThresholds()[3].getValue());
         
         wb2.close();
     }
@@ -1193,9 +1193,9 @@ public abstract class BaseTestConditionalFormatting {
         assertEquals(RangeType.MIN,    clrFmt.getThresholds()[0].getRangeType());
         assertEquals(RangeType.NUMBER, clrFmt.getThresholds()[1].getRangeType());
         assertEquals(RangeType.MAX,    clrFmt.getThresholds()[2].getRangeType());
-        assertEquals(null, clrFmt.getThresholds()[0].getValue());
+        assertNull(clrFmt.getThresholds()[0].getValue());
         assertEquals(10d,  clrFmt.getThresholds()[1].getValue(), 0);
-        assertEquals(null, clrFmt.getThresholds()[2].getValue());
+        assertNull(clrFmt.getThresholds()[2].getValue());
         
         wb2.close();
     }
@@ -1212,9 +1212,9 @@ public abstract class BaseTestConditionalFormatting {
         ConditionalFormattingRule rule1 = 
                 sheetCF.createConditionalFormattingRule(color);
         DataBarFormatting dbFmt = rule1.getDataBarFormatting();
-        
-        assertEquals(false, dbFmt.isIconOnly());
-        assertEquals(true, dbFmt.isLeftToRight());
+
+        assertFalse(dbFmt.isIconOnly());
+        assertTrue(dbFmt.isLeftToRight());
         assertEquals(0,   dbFmt.getWidthMin());
         assertEquals(100, dbFmt.getWidthMax());
         assertColour(colorHex, dbFmt.getColor());
@@ -1237,17 +1237,17 @@ public abstract class BaseTestConditionalFormatting {
         rule1 = cf.getRule(0);
         dbFmt = rule1.getDataBarFormatting();
         assertEquals(ConditionType.DATA_BAR, rule1.getConditionType());
-        
-        assertEquals(false, dbFmt.isIconOnly());
-        assertEquals(true, dbFmt.isLeftToRight());
+
+        assertFalse(dbFmt.isIconOnly());
+        assertTrue(dbFmt.isLeftToRight());
         assertEquals(0,   dbFmt.getWidthMin());
         assertEquals(100, dbFmt.getWidthMax());
         assertColour(colorHex, dbFmt.getColor());
 
         assertEquals(RangeType.MIN, dbFmt.getMinThreshold().getRangeType());
         assertEquals(RangeType.MAX, dbFmt.getMaxThreshold().getRangeType());
-        assertEquals(null, dbFmt.getMinThreshold().getValue());
-        assertEquals(null, dbFmt.getMaxThreshold().getValue());
+        assertNull(dbFmt.getMinThreshold().getValue());
+        assertNull(dbFmt.getMaxThreshold().getValue());
         
         wb2.close();
     }
index bd8c74032bc845f24c5be8f417396e72756c3fdc..89594af0f92b8b28448a9df94c702b7f81eadb8b 100644 (file)
@@ -140,7 +140,7 @@ public abstract class BaseTestFont {
         assertNotNull(wb3.getFontAt(font2Idx));
 
         assertEquals(15, wb3.getFontAt(font2Idx).getFontHeightInPoints());
-        assertEquals(true, wb3.getFontAt(font2Idx).getItalic());
+        assertTrue(wb3.getFontAt(font2Idx).getItalic());
         wb3.close();
     }
 
@@ -195,7 +195,7 @@ public abstract class BaseTestFont {
         assertEquals(nf, wb.getFontAt(nfIdx));
 
         assertEquals(wb.getFontAt(nfIdx), wb.getFontAt(nfIdx));
-        assertTrue(wb.getFontAt(0) != wb.getFontAt(nfIdx));
+        assertNotSame(wb.getFontAt(0), wb.getFontAt(nfIdx));
 
         // Find it now
         assertNotNull(
index b48ebee5a7e9ed9cced5935188943e5036d661ed..206194fcccdb38b71cafe6e84f73ffd86ca4d28b 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.poi.ss.util;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
 
 import org.apache.poi.ss.util.NumberComparisonExamples.ComparisonExample;
@@ -74,7 +75,7 @@ public final class TestNumberComparer {
                double a = 0.06-0.01;
                double b = 0.05;
                //noinspection ConstantConditions
-               assertFalse(a == b);
+        assertNotEquals(a, b, 0.0);
                assertEquals(0, NumberComparer.compare(a, b));
        }
 
@@ -86,7 +87,7 @@ public final class TestNumberComparer {
                double a = 1+1.0028-0.9973;
                double b = 1.0055;
                //noinspection ConstantConditions
-               assertFalse(a == b);
+        assertNotEquals(a, b, 0.0);
                assertEquals(0, NumberComparer.compare(a, b));
        }
 
index a5c953a435d70d74fe7dd3296e7e1028159c6748..1070f1389f35a039546fb4e028907a2eac96b1d1 100644 (file)
@@ -60,22 +60,22 @@ public final class TestBitField extends TestCase {
     }
 
     public void testIsSet() {
-        assertTrue(!bf_multi.isSet(0));
+        assertFalse(bf_multi.isSet(0));
         for (int j = 0x80; j <= 0x3F80; j += 0x80)
         {
             assertTrue(bf_multi.isSet(j));
         }
-        assertTrue(!bf_single.isSet(0));
+        assertFalse(bf_single.isSet(0));
         assertTrue(bf_single.isSet(0x4000));
     }
 
     public void testIsAllSet() {
         for (int j = 0; j < 0x3F80; j += 0x80)
         {
-            assertTrue(!bf_multi.isAllSet(j));
+            assertFalse(bf_multi.isAllSet(j));
         }
         assertTrue(bf_multi.isAllSet(0x3F80));
-        assertTrue(!bf_single.isAllSet(0));
+        assertFalse(bf_single.isAllSet(0));
         assertTrue(bf_single.isAllSet(0x4000));
     }
 
@@ -148,7 +148,7 @@ public final class TestBitField extends TestCase {
         byte clearedBit = BitFieldFactory.getInstance(0x40).setByteBoolean(( byte ) -63,
                                        false);
 
-        assertEquals(false, BitFieldFactory.getInstance(0x40).isSet(clearedBit));
+        assertFalse(BitFieldFactory.getInstance(0x40).isSet(clearedBit));
     }
 
     public void testClear() {
index 7f5f721f502c506bd22bf5b682b2e792f16b0fd5..25d427d361246e0add7e2f9f8aaf75283986399f 100644 (file)
@@ -21,6 +21,8 @@ import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -279,7 +281,7 @@ public final class TestIntList {
 
         assertEquals(list, list);
         //noinspection ObjectEqualsNull
-        assertFalse(list.equals(null));
+        assertNotEquals(null, list);
         IntList list2 = new IntList(200);
 
         assertEquals(list, list2);
@@ -289,15 +291,15 @@ public final class TestIntList {
         list.add(1);
         list2.add(1);
         list2.add(0);
-        assertFalse(list.equals(list2));
+        assertNotEquals(list, list2);
         list2.removeValue(1);
         list2.add(1);
         assertEquals(list, list2);
         assertEquals(list2, list);
         assertEquals(list.hashCode(), list2.hashCode());
         list2.add(2);
-        assertFalse(list.equals(list2));
-        assertFalse(list2.equals(list));
+        assertNotEquals(list, list2);
+        assertNotEquals(list2, list);
     }
 
     @Test
@@ -604,8 +606,8 @@ public final class TestIntList {
         int[] a4     = list.toArray(aShort);
         int[] a5     = list.toArray(aLong);
 
-        assertTrue(a4 != aShort);
-        assertTrue(a5 != aLong);
+        assertNotSame(a4, aShort);
+        assertNotSame(a5, aLong);
         assertEquals(a4.length, list.size());
         for (int j = 0; j < 1000; j++)
         {
index 020081073add0dbaaba468fa8fb987855db938b4..47fa72dbe8996eb113b149ed93ef1a5820a60aea 100644 (file)
@@ -17,7 +17,7 @@
 package org.apache.poi.util;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
@@ -140,7 +140,7 @@ public class TestTempFile {
         // Should be able to create two tempfiles with same prefix and suffix
         File file1 = TempFile.createTempFile("TestTempFile", ".tst");
         File file2 = TempFile.createTempFile("TestTempFile", ".tst");
-        assertFalse(file1.equals(file2));
+        assertNotEquals(file1, file2);
         assertNotNull(file2);
         assertTrue(file2.delete());
         assertNotNull(file1);