aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2014-05-16 13:25:45 +0000
committerDominik Stadler <centic@apache.org>2014-05-16 13:25:45 +0000
commit764ec1df173d6362676b2938f19949cc1b498094 (patch)
treef43046fda98e47383d373679da2e8cd84790ee61 /src/testcases/org/apache
parentb342bc5d8b3021d61aacaed91e2bae567bcd221d (diff)
downloadpoi-764ec1df173d6362676b2938f19949cc1b498094.tar.gz
poi-764ec1df173d6362676b2938f19949cc1b498094.zip
Apache POI - Use assertArrayEquals() instead of assertTrue(Arrays.equals()), this way we get better information on failure
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1595190 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache')
-rw-r--r--src/testcases/org/apache/poi/ddf/TestEscherBlipRecord.java36
-rw-r--r--src/testcases/org/apache/poi/ddf/TestEscherOptRecord.java10
-rw-r--r--src/testcases/org/apache/poi/hssf/model/TestDrawingAggregate.java5
-rw-r--r--src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java42
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestAutoFilterInfoRecord.java4
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestBoolErrRecord.java5
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestBoundSheetRecord.java9
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestColumnInfoRecord.java9
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestDrawingRecord.java7
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestEmbeddedObjectRefSubRecord.java7
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestFtCblsSubRecord.java5
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestHyperlinkRecord.java15
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestLbsDataSubRecord.java30
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestNoteRecord.java5
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestNoteStructureSubRecord.java5
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestObjRecord.java5
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestRecalcIdRecord.java5
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestRecordFactory.java5
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestRecordFactoryInputStream.java5
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestSSTRecord.java6
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestSubRecord.java7
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestTextObjectRecord.java11
-rw-r--r--src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java10
-rw-r--r--src/testcases/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java5
-rw-r--r--src/testcases/org/apache/poi/hssf/record/chart/TestChartFormatRecord.java9
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestCloneSheet.java18
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java29
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java63
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java9
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestPolygon.java52
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestText.java14
-rw-r--r--src/testcases/org/apache/poi/ss/formula/ptg/TestArrayPtg.java5
-rw-r--r--src/testcases/org/apache/poi/ss/formula/ptg/TestAttrPtg.java5
-rw-r--r--src/testcases/org/apache/poi/ss/formula/ptg/TestReferencePtg.java5
-rw-r--r--src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java5
-rw-r--r--src/testcases/org/apache/poi/util/TestLittleEndianStreams.java5
36 files changed, 223 insertions, 249 deletions
diff --git a/src/testcases/org/apache/poi/ddf/TestEscherBlipRecord.java b/src/testcases/org/apache/poi/ddf/TestEscherBlipRecord.java
index 6dffb8df22..899af6e462 100644
--- a/src/testcases/org/apache/poi/ddf/TestEscherBlipRecord.java
+++ b/src/testcases/org/apache/poi/ddf/TestEscherBlipRecord.java
@@ -17,12 +17,14 @@
package org.apache.poi.ddf;
+import static org.junit.Assert.assertArrayEquals;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
-import java.util.Arrays;
import junit.framework.TestCase;
+
import org.apache.poi.POIDataSamples;
/**
@@ -44,20 +46,20 @@ public final class TestEscherBlipRecord extends TestCase {
EscherBSERecord bse1 = (EscherBSERecord)bstore.getChild(0);
assertEquals(EscherBSERecord.BT_PNG, bse1.getBlipTypeWin32());
assertEquals(EscherBSERecord.BT_PNG, bse1.getBlipTypeMacOS());
- assertTrue(Arrays.equals(new byte[]{
+ assertArrayEquals(new byte[]{
0x65, 0x07, 0x4A, (byte)0x8D, 0x3E, 0x42, (byte)0x8B, (byte)0xAC,
0x1D, (byte)0x89, 0x35, 0x4F, 0x48, (byte)0xFA, 0x37, (byte)0xC2
- }, bse1.getUid()));
+ }, bse1.getUid());
assertEquals(255, bse1.getTag());
assertEquals(32308, bse1.getSize());
EscherBitmapBlip blip1 = (EscherBitmapBlip)bse1.getBlipRecord();
assertEquals(0x6E00, blip1.getOptions());
assertEquals(EscherBitmapBlip.RECORD_ID_PNG, blip1.getRecordId());
- assertTrue(Arrays.equals(new byte[]{
+ assertArrayEquals(new byte[]{
0x65, 0x07, 0x4A, (byte)0x8D, 0x3E, 0x42, (byte)0x8B, (byte)0xAC,
0x1D, (byte)0x89, 0x35, 0x4F, 0x48, (byte)0xFA, 0x37, (byte)0xC2
- }, blip1.getUID()));
+ }, blip1.getUID());
//serialize and read again
byte[] ser = bse1.serialize();
@@ -66,7 +68,7 @@ public final class TestEscherBlipRecord extends TestCase {
assertEquals(bse1.getRecordId(), bse2.getRecordId());
assertEquals(bse1.getBlipTypeWin32(), bse2.getBlipTypeWin32());
assertEquals(bse1.getBlipTypeMacOS(), bse2.getBlipTypeMacOS());
- assertTrue(Arrays.equals(bse1.getUid(), bse2.getUid()));
+ assertArrayEquals(bse1.getUid(), bse2.getUid());
assertEquals(bse1.getTag(), bse2.getTag());
assertEquals(bse1.getSize(), bse2.getSize());
@@ -75,7 +77,7 @@ public final class TestEscherBlipRecord extends TestCase {
assertEquals(blip1.getRecordId(), blip2.getRecordId());
assertEquals(blip1.getUID(), blip2.getUID());
- assertTrue(Arrays.equals(blip1.getPicturedata(), blip1.getPicturedata()));
+ assertArrayEquals(blip1.getPicturedata(), blip1.getPicturedata());
}
//test reading/serializing of a PICT metafile
@@ -90,24 +92,24 @@ public final class TestEscherBlipRecord extends TestCase {
//System.out.println(bse1);
assertEquals(EscherBSERecord.BT_WMF, bse1.getBlipTypeWin32());
assertEquals(EscherBSERecord.BT_PICT, bse1.getBlipTypeMacOS());
- assertTrue(Arrays.equals(new byte[]{
+ assertArrayEquals(new byte[]{
(byte)0xC7, 0x15, 0x69, 0x2D, (byte)0xE5, (byte)0x89, (byte)0xA3, 0x6F,
0x66, 0x03, (byte)0xD6, 0x24, (byte)0xF7, (byte)0xDB, 0x1D, 0x13
- }, bse1.getUid()));
+ }, bse1.getUid());
assertEquals(255, bse1.getTag());
assertEquals(1133, bse1.getSize());
EscherMetafileBlip blip1 = (EscherMetafileBlip)bse1.getBlipRecord();
assertEquals(0x5430, blip1.getOptions());
assertEquals(EscherMetafileBlip.RECORD_ID_PICT, blip1.getRecordId());
- assertTrue(Arrays.equals(new byte[]{
+ assertArrayEquals(new byte[]{
0x57, 0x32, 0x7B, (byte)0x91, 0x23, 0x5D, (byte)0xDB, 0x36,
0x7A, (byte)0xDB, (byte)0xFF, 0x17, (byte)0xFE, (byte)0xF3, (byte)0xA7, 0x05
- }, blip1.getUID()));
- assertTrue(Arrays.equals(new byte[]{
+ }, blip1.getUID());
+ assertArrayEquals(new byte[]{
(byte)0xC7, 0x15, 0x69, 0x2D, (byte)0xE5, (byte)0x89, (byte)0xA3, 0x6F,
0x66, 0x03, (byte)0xD6, 0x24, (byte)0xF7, (byte)0xDB, 0x1D, 0x13
- }, blip1.getPrimaryUID()));
+ }, blip1.getPrimaryUID());
//serialize and read again
byte[] ser = bse1.serialize();
@@ -117,7 +119,7 @@ public final class TestEscherBlipRecord extends TestCase {
assertEquals(bse1.getOptions(), bse2.getOptions());
assertEquals(bse1.getBlipTypeWin32(), bse2.getBlipTypeWin32());
assertEquals(bse1.getBlipTypeMacOS(), bse2.getBlipTypeMacOS());
- assertTrue(Arrays.equals(bse1.getUid(), bse2.getUid()));
+ assertArrayEquals(bse1.getUid(), bse2.getUid());
assertEquals(bse1.getTag(), bse2.getTag());
assertEquals(bse1.getSize(), bse2.getSize());
@@ -127,7 +129,7 @@ public final class TestEscherBlipRecord extends TestCase {
assertEquals(blip1.getUID(), blip2.getUID());
assertEquals(blip1.getPrimaryUID(), blip2.getPrimaryUID());
- assertTrue(Arrays.equals(blip1.getPicturedata(), blip1.getPicturedata()));
+ assertArrayEquals(blip1.getPicturedata(), blip1.getPicturedata());
}
//integral test: check that the read-write-read round trip is consistent
@@ -138,7 +140,7 @@ public final class TestEscherBlipRecord extends TestCase {
record.fillFields(data, 0, new DefaultEscherRecordFactory());
byte[] ser = record.serialize();
- assertTrue(Arrays.equals(data, ser));
+ assertArrayEquals(data, ser);
}
private byte[] read(File file) {
@@ -169,6 +171,6 @@ public final class TestEscherBlipRecord extends TestCase {
assertNotNull(remaining);
byte[] ser = bse.serialize(); //serialize and assert against the source data
- assertTrue(Arrays.equals(data, ser));
+ assertArrayEquals(data, ser);
}
}
diff --git a/src/testcases/org/apache/poi/ddf/TestEscherOptRecord.java b/src/testcases/org/apache/poi/ddf/TestEscherOptRecord.java
index b8a3e9c117..0b43a0edfb 100644
--- a/src/testcases/org/apache/poi/ddf/TestEscherOptRecord.java
+++ b/src/testcases/org/apache/poi/ddf/TestEscherOptRecord.java
@@ -17,11 +17,11 @@
package org.apache.poi.ddf;
+import static org.junit.Assert.assertArrayEquals;
import junit.framework.TestCase;
-import org.apache.poi.util.HexRead;
-import org.apache.poi.util.HexDump;
-import java.util.Arrays;
+import org.apache.poi.util.HexDump;
+import org.apache.poi.util.HexRead;
public final class TestEscherOptRecord extends TestCase {
@@ -299,7 +299,7 @@ public final class TestEscherOptRecord extends TestCase {
opt2.fillFields( data1, new DefaultEscherRecordFactory() );
byte[] data2 = opt2.serialize();
- assertTrue(Arrays.equals(data1, data2));
+ assertArrayEquals(data1, data2);
}
/**
@@ -319,6 +319,6 @@ public final class TestEscherOptRecord extends TestCase {
assertEquals(0, p.getNumberOfElementsInArray());
byte[] data2 = opt2.serialize();
- assertTrue(Arrays.equals(data1, data2));
+ assertArrayEquals(data1, data2);
}
}
diff --git a/src/testcases/org/apache/poi/hssf/model/TestDrawingAggregate.java b/src/testcases/org/apache/poi/hssf/model/TestDrawingAggregate.java
index 5920202c75..ca8e255c13 100644
--- a/src/testcases/org/apache/poi/hssf/model/TestDrawingAggregate.java
+++ b/src/testcases/org/apache/poi/hssf/model/TestDrawingAggregate.java
@@ -16,6 +16,8 @@
==================================================================== */
package org.apache.poi.hssf.model;
+import static org.junit.Assert.assertArrayEquals;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -169,6 +171,7 @@ public class TestDrawingAggregate extends TestCase {
public void testAllTestSamples(){
File[] xls = new File(System.getProperty("POI.testdata.path"), "spreadsheet").listFiles(
new FilenameFilter() {
+ @Override
public boolean accept(File dir, String name) {
return name.endsWith(".xls");
}
@@ -471,7 +474,7 @@ public class TestDrawingAggregate extends TestCase {
assertEquals(r1.getRecordSize(), r2.getRecordSize());
if (r1 instanceof Record) {
assertEquals(((Record) r1).getSid(), ((Record) r2).getSid());
- assertTrue(Arrays.equals(((Record) r1).serialize(), ((Record) r2).serialize()));
+ assertArrayEquals(((Record) r1).serialize(), ((Record) r2).serialize());
}
}
}
diff --git a/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java b/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java
index 6cdb1dd5f3..fa872e1e31 100644
--- a/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java
+++ b/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java
@@ -17,49 +17,13 @@
package org.apache.poi.hssf.model;
-import java.util.Arrays;
-
+import static org.junit.Assert.assertArrayEquals;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.hssf.record.NameRecord;
import org.apache.poi.hssf.record.common.UnicodeString;
-import org.apache.poi.ss.formula.constant.ErrorConstant;
-import org.apache.poi.ss.formula.ptg.AbstractFunctionPtg;
-import org.apache.poi.ss.formula.ptg.AddPtg;
-import org.apache.poi.ss.formula.ptg.Area3DPtg;
-import org.apache.poi.ss.formula.ptg.AreaI;
-import org.apache.poi.ss.formula.ptg.AreaPtg;
-import org.apache.poi.ss.formula.ptg.AreaPtgBase;
-import org.apache.poi.ss.formula.ptg.ArrayPtg;
-import org.apache.poi.ss.formula.ptg.AttrPtg;
-import org.apache.poi.ss.formula.ptg.BoolPtg;
-import org.apache.poi.ss.formula.ptg.ConcatPtg;
-import org.apache.poi.ss.formula.ptg.DividePtg;
-import org.apache.poi.ss.formula.ptg.EqualPtg;
-import org.apache.poi.ss.formula.ptg.ErrPtg;
-import org.apache.poi.ss.formula.ptg.FuncPtg;
-import org.apache.poi.ss.formula.ptg.FuncVarPtg;
-import org.apache.poi.ss.formula.ptg.IntPtg;
-import org.apache.poi.ss.formula.ptg.MemAreaPtg;
-import org.apache.poi.ss.formula.ptg.MemFuncPtg;
-import org.apache.poi.ss.formula.ptg.MissingArgPtg;
-import org.apache.poi.ss.formula.ptg.MultiplyPtg;
-import org.apache.poi.ss.formula.ptg.NamePtg;
-import org.apache.poi.ss.formula.ptg.NumberPtg;
-import org.apache.poi.ss.formula.ptg.ParenthesisPtg;
-import org.apache.poi.ss.formula.ptg.PercentPtg;
-import org.apache.poi.ss.formula.ptg.PowerPtg;
-import org.apache.poi.ss.formula.ptg.Ptg;
-import org.apache.poi.ss.formula.ptg.RangePtg;
-import org.apache.poi.ss.formula.ptg.Ref3DPtg;
-import org.apache.poi.ss.formula.ptg.RefPtg;
-import org.apache.poi.ss.formula.ptg.StringPtg;
-import org.apache.poi.ss.formula.ptg.SubtractPtg;
-import org.apache.poi.ss.formula.ptg.UnaryMinusPtg;
-import org.apache.poi.ss.formula.ptg.UnaryPlusPtg;
-import org.apache.poi.ss.formula.ptg.UnionPtg;
import org.apache.poi.hssf.usermodel.FormulaExtractor;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFErrorConstants;
@@ -72,6 +36,8 @@ import org.apache.poi.hssf.usermodel.TestHSSFName;
import org.apache.poi.ss.formula.FormulaParseException;
import org.apache.poi.ss.formula.FormulaParser;
import org.apache.poi.ss.formula.FormulaType;
+import org.apache.poi.ss.formula.constant.ErrorConstant;
+import org.apache.poi.ss.formula.ptg.*;
import org.apache.poi.ss.usermodel.BaseTestBugzillaIssues;
import org.apache.poi.ss.usermodel.Name;
import org.apache.poi.util.HexRead;
@@ -909,7 +875,7 @@ public final class TestFormulaParser extends TestCase {
+ "00 00 00 " // Array data: 1 col, 1 row
+ "02 01 00 00 35" // elem (type=string, len=1, "5")
);
- assertTrue(Arrays.equals(expData, data));
+ assertArrayEquals(expData, data);
int initSize = Ptg.getEncodedSizeWithoutArrayData(ptgs);
Ptg[] ptgs2 = Ptg.readTokens(initSize, new LittleEndianByteArrayInputStream(data));
confirmTokenClasses(ptgs2, ArrayPtg.class, IntPtg.class, FuncVarPtg.class);
diff --git a/src/testcases/org/apache/poi/hssf/record/TestAutoFilterInfoRecord.java b/src/testcases/org/apache/poi/hssf/record/TestAutoFilterInfoRecord.java
index 13f854dbda..8319657c69 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestAutoFilterInfoRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestAutoFilterInfoRecord.java
@@ -17,8 +17,8 @@
package org.apache.poi.hssf.record;
+import static org.junit.Assert.assertArrayEquals;
import junit.framework.TestCase;
-import java.util.Arrays;
/**
* Tests the AutoFilterInfoRecord class.
@@ -62,6 +62,6 @@ public final class TestAutoFilterInfoRecord extends TestCase {
byte[] cln = cloned.serialize();
assertEquals(record.getDataSize(), cloned.getDataSize());
- assertTrue(Arrays.equals(src, cln));
+ assertArrayEquals(src, cln);
}
} \ No newline at end of file
diff --git a/src/testcases/org/apache/poi/hssf/record/TestBoolErrRecord.java b/src/testcases/org/apache/poi/hssf/record/TestBoolErrRecord.java
index 2c90208399..67b151c661 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestBoolErrRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestBoolErrRecord.java
@@ -17,8 +17,7 @@
package org.apache.poi.hssf.record;
-import java.util.Arrays;
-
+import static org.junit.Assert.assertArrayEquals;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
@@ -80,6 +79,6 @@ public final class TestBoolErrRecord extends TestCase {
"00 00 00 00 0F 00 " +
"01 00 " // normal number of data bytes
);
- assertTrue(Arrays.equals(expData, outData));
+ assertArrayEquals(expData, outData);
}
}
diff --git a/src/testcases/org/apache/poi/hssf/record/TestBoundSheetRecord.java b/src/testcases/org/apache/poi/hssf/record/TestBoundSheetRecord.java
index 72d26d04d0..d50ae9e73a 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestBoundSheetRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestBoundSheetRecord.java
@@ -17,15 +17,16 @@
package org.apache.poi.hssf.record;
+import static org.junit.Assert.assertArrayEquals;
+
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
-import org.apache.poi.util.HexRead;
-
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
+import org.apache.poi.util.HexRead;
+
/**
* Tests BoundSheetRecord.
*
@@ -76,7 +77,7 @@ public final class TestBoundSheetRecord extends TestCase {
assertEquals("\u0421\u0442\u0440\u0430\u043D\u0438\u0447\u043A\u0430", bsr.getSheetname());
byte[] data2 = bsr.serialize();
- assertTrue(Arrays.equals(data, data2));
+ assertArrayEquals(data, data2);
}
public void testOrdering() {
diff --git a/src/testcases/org/apache/poi/hssf/record/TestColumnInfoRecord.java b/src/testcases/org/apache/poi/hssf/record/TestColumnInfoRecord.java
index fd0e41217e..8e5b482761 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestColumnInfoRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestColumnInfoRecord.java
@@ -17,8 +17,7 @@
package org.apache.poi.hssf.record;
-import java.util.Arrays;
-
+import static org.junit.Assert.assertArrayEquals;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
@@ -45,7 +44,7 @@ public final class TestColumnInfoRecord extends TestCase {
assertEquals(true, cir.getHidden());
assertEquals(3, cir.getOutlineLevel());
assertEquals(true, cir.getCollapsed());
- assertTrue(Arrays.equals(data, cir.serialize()));
+ assertArrayEquals(data, cir.serialize());
}
/**
@@ -69,7 +68,7 @@ public final class TestColumnInfoRecord extends TestCase {
throw e;
}
assertEquals(0, in.remaining());
- assertTrue(Arrays.equals(outData, cir.serialize()));
+ assertArrayEquals(outData, cir.serialize());
}
/**
@@ -83,6 +82,6 @@ public final class TestColumnInfoRecord extends TestCase {
RecordInputStream in = TestcaseRecordInputStream.create(inpData);
ColumnInfoRecord cir = new ColumnInfoRecord(in);
assertEquals(0, in.remaining());
- assertTrue(Arrays.equals(outData, cir.serialize()));
+ assertArrayEquals(outData, cir.serialize());
}
}
diff --git a/src/testcases/org/apache/poi/hssf/record/TestDrawingRecord.java b/src/testcases/org/apache/poi/hssf/record/TestDrawingRecord.java
index 38992c0bdf..0cde3e47d1 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestDrawingRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestDrawingRecord.java
@@ -17,6 +17,8 @@
package org.apache.poi.hssf.record;
+import static org.junit.Assert.assertArrayEquals;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -31,6 +33,7 @@ public final class TestDrawingRecord extends TestCase {
* Check that RecordFactoryInputStream properly handles continued DrawingRecords
* See Bugzilla #47548
*/
+ @SuppressWarnings("deprecation")
public void testReadContinued() throws IOException {
//simulate a continues drawing record
@@ -53,8 +56,8 @@ public final class TestDrawingRecord extends TestCase {
assertTrue(rec.get(0) instanceof DrawingRecord);
assertTrue(rec.get(1) instanceof ContinueRecord);
- assertTrue(Arrays.equals(data1, ((DrawingRecord)rec.get(0)).getData()));
- assertTrue(Arrays.equals(data2, ((ContinueRecord)rec.get(1)).getData()));
+ assertArrayEquals(data1, ((DrawingRecord)rec.get(0)).getData());
+ assertArrayEquals(data2, ((ContinueRecord)rec.get(1)).getData());
}
diff --git a/src/testcases/org/apache/poi/hssf/record/TestEmbeddedObjectRefSubRecord.java b/src/testcases/org/apache/poi/hssf/record/TestEmbeddedObjectRefSubRecord.java
index 70e421a6d8..3f7dd86436 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestEmbeddedObjectRefSubRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestEmbeddedObjectRefSubRecord.java
@@ -17,8 +17,7 @@
package org.apache.poi.hssf.record;
-import java.util.Arrays;
-
+import static org.junit.Assert.assertArrayEquals;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
@@ -57,7 +56,7 @@ public final class TestEmbeddedObjectRefSubRecord extends TestCase {
assertEquals(record1.getOLEClassName(), record2.getOLEClassName());
byte[] ser2 = record1.serialize();
- assertTrue(Arrays.equals(ser, ser2));
+ assertArrayEquals(ser, ser2);
}
/**
@@ -85,7 +84,7 @@ public final class TestEmbeddedObjectRefSubRecord extends TestCase {
assertEquals(record1.getStreamId(), record2.getStreamId());
byte[] ser2 = record1.serialize();
- assertTrue(Arrays.equals(ser, ser2));
+ assertArrayEquals(ser, ser2);
}
public void testCameraTool_bug45912() {
diff --git a/src/testcases/org/apache/poi/hssf/record/TestFtCblsSubRecord.java b/src/testcases/org/apache/poi/hssf/record/TestFtCblsSubRecord.java
index 3d71a8cb32..f158f86422 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestFtCblsSubRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestFtCblsSubRecord.java
@@ -18,10 +18,9 @@
package org.apache.poi.hssf.record;
+import static org.junit.Assert.assertArrayEquals;
import junit.framework.TestCase;
-import java.util.Arrays;
-
/**
* Tests the serialization and deserialization of the FtCblsSubRecord
* class works correctly.
@@ -61,6 +60,6 @@ public final class TestFtCblsSubRecord extends TestCase {
byte[] cln = cloned.serialize();
assertEquals(record.getDataSize(), cloned.getDataSize());
- assertTrue(Arrays.equals(src, cln));
+ assertArrayEquals(src, cln);
}
} \ No newline at end of file
diff --git a/src/testcases/org/apache/poi/hssf/record/TestHyperlinkRecord.java b/src/testcases/org/apache/poi/hssf/record/TestHyperlinkRecord.java
index 3383bccbbf..8c7e71fb29 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestHyperlinkRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestHyperlinkRecord.java
@@ -16,8 +16,7 @@
==================================================================== */
package org.apache.poi.hssf.record;
-import java.util.Arrays;
-
+import static org.junit.Assert.assertArrayEquals;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
@@ -345,7 +344,7 @@ public final class TestHyperlinkRecord extends TestCase {
link = new HyperlinkRecord(is);
byte[] bytes2 = link.serialize();
assertEquals(bytes1.length, bytes2.length);
- assertTrue(Arrays.equals(bytes1, bytes2));
+ assertArrayEquals(bytes1, bytes2);
}
public void testSerialize(){
@@ -367,7 +366,7 @@ public final class TestHyperlinkRecord extends TestCase {
byte[] ser = new byte[tmp.length-4];
System.arraycopy(tmp, 4, ser, 0, ser.length);
assertEquals(data1.length, ser.length);
- assertTrue(Arrays.equals(data1, ser));
+ assertArrayEquals(data1, ser);
}
public void testCreateFileRecord() {
@@ -382,7 +381,7 @@ public final class TestHyperlinkRecord extends TestCase {
byte[] ser = new byte[tmp.length-4];
System.arraycopy(tmp, 4, ser, 0, ser.length);
assertEquals(data2.length, ser.length);
- assertTrue(Arrays.equals(data2, ser));
+ assertArrayEquals(data2, ser);
}
public void testCreateDocumentRecord() {
@@ -397,7 +396,7 @@ public final class TestHyperlinkRecord extends TestCase {
byte[] ser = new byte[tmp.length-4];
System.arraycopy(tmp, 4, ser, 0, ser.length);
assertEquals(data4.length, ser.length);
- assertTrue(Arrays.equals(data4, ser));
+ assertArrayEquals(data4, ser);
}
public void testCreateEmailtRecord() {
@@ -412,7 +411,7 @@ public final class TestHyperlinkRecord extends TestCase {
byte[] ser = new byte[tmp.length-4];
System.arraycopy(tmp, 4, ser, 0, ser.length);
assertEquals(data3.length, ser.length);
- assertTrue(Arrays.equals(data3, ser));
+ assertArrayEquals(data3, ser);
}
public void testClone() {
@@ -421,7 +420,7 @@ public final class TestHyperlinkRecord extends TestCase {
RecordInputStream is = TestcaseRecordInputStream.create(HyperlinkRecord.sid, data[i]);
HyperlinkRecord link = new HyperlinkRecord(is);
HyperlinkRecord clone = (HyperlinkRecord)link.clone();
- assertTrue(Arrays.equals(link.serialize(), clone.serialize()));
+ assertArrayEquals(link.serialize(), clone.serialize());
}
}
diff --git a/src/testcases/org/apache/poi/hssf/record/TestLbsDataSubRecord.java b/src/testcases/org/apache/poi/hssf/record/TestLbsDataSubRecord.java
index acf005be03..0f53548406 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestLbsDataSubRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestLbsDataSubRecord.java
@@ -18,9 +18,11 @@
package org.apache.poi.hssf.record;
+import static org.junit.Assert.assertArrayEquals;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.util.Arrays;
+import java.io.IOException;
import junit.framework.TestCase;
@@ -143,10 +145,10 @@ public final class TestLbsDataSubRecord extends TestCase {
RecordInputStream in2 = TestcaseRecordInputStream.create(ser);
ObjRecord record2 = new ObjRecord(in2);
byte[] ser2 = record2.serialize();
- assertTrue(Arrays.equals(ser, ser2));
+ assertArrayEquals(ser, ser2);
}
- public void test_LbsDropData(){
+ public void test_LbsDropData() throws IOException{
byte[] data = HexRead.readFromString(
//LbsDropData
"0A, 00, " + //flags
@@ -157,12 +159,20 @@ public final class TestLbsDataSubRecord extends TestCase {
"00"); //padding byte
LittleEndianInputStream in = new LittleEndianInputStream(new ByteArrayInputStream(data));
-
- LbsDataSubRecord.LbsDropData lbs = new LbsDataSubRecord.LbsDropData(in);
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- lbs.serialize(new LittleEndianOutputStream(baos));
-
- assertTrue(Arrays.equals(data, baos.toByteArray()));
+ try {
+ LbsDataSubRecord.LbsDropData lbs = new LbsDataSubRecord.LbsDropData(in);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ LittleEndianOutputStream out = new LittleEndianOutputStream(baos);
+ try {
+ lbs.serialize(out);
+
+ assertArrayEquals(data, baos.toByteArray());
+ } finally {
+ out.close();
+ }
+ } finally {
+ in.close();
+ }
}
}
diff --git a/src/testcases/org/apache/poi/hssf/record/TestNoteRecord.java b/src/testcases/org/apache/poi/hssf/record/TestNoteRecord.java
index c7e0dee3d1..427a48f935 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestNoteRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestNoteRecord.java
@@ -17,11 +17,10 @@
package org.apache.poi.hssf.record;
+import static org.junit.Assert.assertArrayEquals;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
-import java.util.Arrays;
-
import org.apache.poi.util.HexRead;
/**
@@ -84,7 +83,7 @@ public final class TestNoteRecord extends TestCase {
//finally check that the serialized data is the same
byte[] src = record.serialize();
byte[] cln = cloned.serialize();
- assertTrue(Arrays.equals(src, cln));
+ assertArrayEquals(src, cln);
}
public void testUnicodeAuthor() {
diff --git a/src/testcases/org/apache/poi/hssf/record/TestNoteStructureSubRecord.java b/src/testcases/org/apache/poi/hssf/record/TestNoteStructureSubRecord.java
index ff93c90c24..db3367a033 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestNoteStructureSubRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestNoteStructureSubRecord.java
@@ -18,10 +18,9 @@
package org.apache.poi.hssf.record;
+import static org.junit.Assert.assertArrayEquals;
import junit.framework.TestCase;
-import java.util.Arrays;
-
/**
* Tests the serialization and deserialization of the NoteRecord
* class works correctly. Test data taken directly from a real
@@ -63,6 +62,6 @@ public final class TestNoteStructureSubRecord extends TestCase {
byte[] cln = cloned.serialize();
assertEquals(record.getDataSize(), cloned.getDataSize());
- assertTrue(Arrays.equals(src, cln));
+ assertArrayEquals(src, cln);
}
}
diff --git a/src/testcases/org/apache/poi/hssf/record/TestObjRecord.java b/src/testcases/org/apache/poi/hssf/record/TestObjRecord.java
index de53ecb3e9..504180d62d 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestObjRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestObjRecord.java
@@ -17,7 +17,8 @@
package org.apache.poi.hssf.record;
-import java.util.Arrays;
+import static org.junit.Assert.assertArrayEquals;
+
import java.util.List;
import junit.framework.AssertionFailedError;
@@ -76,7 +77,7 @@ public final class TestObjRecord extends TestCase {
assertEquals(26, recordBytes.length - 4);
byte[] subData = new byte[recdata.length];
System.arraycopy(recordBytes, 4, subData, 0, subData.length);
- assertTrue(Arrays.equals(recdata, subData));
+ assertArrayEquals(recdata, subData);
}
public void testConstruct() {
diff --git a/src/testcases/org/apache/poi/hssf/record/TestRecalcIdRecord.java b/src/testcases/org/apache/poi/hssf/record/TestRecalcIdRecord.java
index 9ac03d2e4e..868cf8e00f 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestRecalcIdRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestRecalcIdRecord.java
@@ -17,8 +17,7 @@
package org.apache.poi.hssf.record;
-import java.util.Arrays;
-
+import static org.junit.Assert.assertArrayEquals;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
@@ -67,6 +66,6 @@ public final class TestRecalcIdRecord extends TestCase {
throw e;
}
assertEquals(0, in.remaining());
- assertTrue(Arrays.equals(r.serialize(), goodData));
+ assertArrayEquals(r.serialize(), goodData);
}
}
diff --git a/src/testcases/org/apache/poi/hssf/record/TestRecordFactory.java b/src/testcases/org/apache/poi/hssf/record/TestRecordFactory.java
index 1ade68044d..c61c049763 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestRecordFactory.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestRecordFactory.java
@@ -17,11 +17,12 @@
package org.apache.poi.hssf.record;
+import static org.junit.Assert.assertArrayEquals;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -200,7 +201,7 @@ public final class TestRecordFactory extends TestCase {
byte[] ser = out.toByteArray();
assertEquals(data.length, ser.length);
- assertTrue(Arrays.equals(data, ser));
+ assertArrayEquals(data, ser);
}
public void testNonZeroPadding_bug46987() {
diff --git a/src/testcases/org/apache/poi/hssf/record/TestRecordFactoryInputStream.java b/src/testcases/org/apache/poi/hssf/record/TestRecordFactoryInputStream.java
index 8df989d158..c2ad641bcb 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestRecordFactoryInputStream.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestRecordFactoryInputStream.java
@@ -17,11 +17,10 @@
package org.apache.poi.hssf.record;
+import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
-import java.util.Arrays;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey;
@@ -152,7 +151,7 @@ public final class TestRecordFactoryInputStream {
private void confirmReadInitialRecords(RecordFactoryInputStream rfis) {
assertEquals(BOFRecord.class, rfis.nextRecord().getClass());
WindowOneRecord rec1 = (WindowOneRecord) rfis.nextRecord();
- assertTrue(Arrays.equals(HexRead.readFromString(SAMPLE_WINDOW1),rec1.serialize()));
+ assertArrayEquals(HexRead.readFromString(SAMPLE_WINDOW1),rec1.serialize());
}
private static RecordFactoryInputStream createRFIS(byte[] data) {
diff --git a/src/testcases/org/apache/poi/hssf/record/TestSSTRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSSTRecord.java
index c7d911b807..c33690d83b 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestSSTRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestSSTRecord.java
@@ -17,6 +17,8 @@
package org.apache.poi.hssf.record;
+import static org.junit.Assert.assertArrayEquals;
+
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -96,7 +98,7 @@ public final class TestSSTRecord extends TestCase {
assertEquals( 688, record.getNumUniqueStrings() );
assertEquals( 688, record.countStrings() );
ser_output = record.serialize();
- assertTrue(Arrays.equals(origData, ser_output));
+ assertArrayEquals(origData, ser_output);
// testing based on new bug report
origData = concatHexDumps("BigSSTRecord2", "BigSSTRecord2CR1", "BigSSTRecord2CR2", "BigSSTRecord2CR3",
@@ -120,7 +122,7 @@ public final class TestSSTRecord extends TestCase {
// TODO - trivial differences in ContinueRecord break locations
// Sample data should be checked against what most recent Excel version produces.
// maybe tweaks are required in ContinuableRecordOutput
- assertTrue(Arrays.equals(origData, ser_output));
+ assertArrayEquals(origData, ser_output);
}
}
diff --git a/src/testcases/org/apache/poi/hssf/record/TestSubRecord.java b/src/testcases/org/apache/poi/hssf/record/TestSubRecord.java
index 926f243975..56bc99f26c 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestSubRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestSubRecord.java
@@ -19,8 +19,7 @@
package org.apache.poi.hssf.record;
-import java.util.Arrays;
-
+import static org.junit.Assert.assertArrayEquals;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
@@ -81,7 +80,7 @@ public final class TestSubRecord extends TestCase {
throw new AssertionFailedError("Identified bug 45778");
}
assertEquals(74, data2.length);
- assertTrue(Arrays.equals(dataAutoFilter, data2));
+ assertArrayEquals(dataAutoFilter, data2);
}
public void testReadManualComboWithFormula() {
@@ -108,7 +107,7 @@ public final class TestSubRecord extends TestCase {
throw new AssertionFailedError("Encoded data differs at index " + i);
}
}
- assertTrue(Arrays.equals(data, data2));
+ assertArrayEquals(data, data2);
}
/**
diff --git a/src/testcases/org/apache/poi/hssf/record/TestTextObjectRecord.java b/src/testcases/org/apache/poi/hssf/record/TestTextObjectRecord.java
index b56da2fbee..29d525098b 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestTextObjectRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestTextObjectRecord.java
@@ -17,14 +17,15 @@
package org.apache.poi.hssf.record;
+import static org.junit.Assert.assertArrayEquals;
+
import java.io.ByteArrayInputStream;
-import java.util.Arrays;
import junit.framework.TestCase;
+import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.ss.formula.ptg.Ptg;
import org.apache.poi.ss.formula.ptg.RefPtg;
-import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.util.HexRead;
import org.apache.poi.util.LittleEndian;
@@ -73,7 +74,7 @@ public final class TestTextObjectRecord extends TestCase {
byte [] ser = record.serialize();
assertEquals(ser.length , simpleData.length);
- assertTrue(Arrays.equals(simpleData, ser));
+ assertArrayEquals(simpleData, ser);
//read again
RecordInputStream is = TestcaseRecordInputStream.create(simpleData);
@@ -147,7 +148,7 @@ public final class TestTextObjectRecord extends TestCase {
//finally check that the serialized data is the same
byte[] src = obj.serialize();
byte[] cln = cloned.serialize();
- assertTrue(Arrays.equals(src, cln));
+ assertArrayEquals(src, cln);
}
/** similar to {@link #simpleData} but with link formula at end of TXO rec*/
@@ -189,6 +190,6 @@ public final class TestTextObjectRecord extends TestCase {
byte [] data2 = rec.serialize();
assertEquals(linkData.length, data2.length);
- assertTrue(Arrays.equals(linkData, data2));
+ assertArrayEquals(linkData, data2);
}
}
diff --git a/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java b/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java
index f199dfd8b5..71e48f2171 100644
--- a/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java
+++ b/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java
@@ -17,14 +17,16 @@
package org.apache.poi.hssf.record.aggregates;
+import static org.junit.Assert.assertArrayEquals;
+
import java.util.Arrays;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import org.apache.poi.hssf.HSSFTestDataSamples;
-import org.apache.poi.hssf.model.RecordStream;
import org.apache.poi.hssf.model.InternalSheet;
+import org.apache.poi.hssf.model.RecordStream;
import org.apache.poi.hssf.record.*;
import org.apache.poi.hssf.usermodel.HSSFPrintSetup;
import org.apache.poi.hssf.usermodel.HSSFSheet;
@@ -299,7 +301,7 @@ public final class TestPageSettingsBlock extends TestCase {
Record[] outRecs = rc.getRecords();
// records were assembled in standard order, so this simple check is OK
- assertTrue(Arrays.equals(recs, outRecs));
+ assertArrayEquals(recs, outRecs);
}
public void testDuplicateHeaderFooter_bug48026() {
@@ -368,14 +370,14 @@ public final class TestPageSettingsBlock extends TestCase {
}
HeaderFooterRecord hd1 = (HeaderFooterRecord)expectedRecs[4];
//GUID is zero
- assertTrue(Arrays.equals(new byte[16], hd1.getGuid()));
+ assertArrayEquals(new byte[16], hd1.getGuid());
assertTrue(hd1.isCurrentSheet());
UserSViewBegin svb = (UserSViewBegin)expectedRecs[7];
HeaderFooterRecord hd2 = (HeaderFooterRecord)expectedRecs[9];
assertFalse(hd2.isCurrentSheet());
//GUIDs of HeaderFooterRecord and UserSViewBegin must be the same
- assertTrue(Arrays.equals(svb.getGuid(), hd2.getGuid()));
+ assertArrayEquals(svb.getGuid(), hd2.getGuid());
}
}
diff --git a/src/testcases/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java b/src/testcases/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java
index 5fd20be332..ce252052eb 100644
--- a/src/testcases/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java
+++ b/src/testcases/org/apache/poi/hssf/record/aggregates/TestValueRecordsAggregate.java
@@ -17,10 +17,11 @@
package org.apache.poi.hssf.record.aggregates;
+import static org.junit.Assert.assertArrayEquals;
+
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.zip.CRC32;
@@ -185,7 +186,7 @@ public final class TestValueRecordsAggregate extends TestCase {
valueRecord.visitCellsForRow(1, sv);
valueRecord.visitCellsForRow(2, sv);
assertEquals(actualArray.length, sv.getWriteIndex());
- assertTrue(Arrays.equals(expectedArray, actualArray));
+ assertArrayEquals(expectedArray, actualArray);
}
private static BlankRecord newBlankRecord() {
diff --git a/src/testcases/org/apache/poi/hssf/record/chart/TestChartFormatRecord.java b/src/testcases/org/apache/poi/hssf/record/chart/TestChartFormatRecord.java
index 94086bcec1..15c2090885 100644
--- a/src/testcases/org/apache/poi/hssf/record/chart/TestChartFormatRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/chart/TestChartFormatRecord.java
@@ -17,15 +17,14 @@
package org.apache.poi.hssf.record.chart;
-import java.util.Arrays;
+import static org.junit.Assert.assertArrayEquals;
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
import org.apache.poi.hssf.record.RecordInputStream;
import org.apache.poi.hssf.record.TestcaseRecordInputStream;
import org.apache.poi.util.HexRead;
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
-
/**
* Tests for {@link ChartFormatRecord} Test data taken directly from a real
* Excel file.
@@ -56,6 +55,6 @@ public final class TestChartFormatRecord extends TestCase {
assertEquals(24, record.getRecordSize());
byte[] data2 = record.serialize();
- assertTrue(Arrays.equals(data, data2));
+ assertArrayEquals(data, data2);
}
}
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestCloneSheet.java b/src/testcases/org/apache/poi/hssf/usermodel/TestCloneSheet.java
index 10acaa5e9f..56a5bb1624 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestCloneSheet.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestCloneSheet.java
@@ -17,6 +17,11 @@
package org.apache.poi.hssf.usermodel;
+import static org.junit.Assert.assertArrayEquals;
+
+import java.io.IOException;
+import java.util.Arrays;
+
import junit.framework.TestCase;
import org.apache.poi.ddf.EscherDgRecord;
@@ -24,9 +29,6 @@ import org.apache.poi.ddf.EscherSpRecord;
import org.apache.poi.hssf.record.EscherAggregate;
import org.apache.poi.ss.util.CellRangeAddress;
-import java.io.IOException;
-import java.util.Arrays;
-
/**
* Test the ability to clone a sheet.
* If adding new records that belong to a sheet (as opposed to a book)
@@ -104,7 +106,7 @@ public final class TestCloneSheet extends TestCase {
assertEquals(agg1.serialize().length, agg2.serialize().length);
assertEquals(agg1.toXml(""), agg2.toXml(""));
- assertTrue(Arrays.equals(agg1.serialize(), agg2.serialize()));
+ assertArrayEquals(agg1.serialize(), agg2.serialize());
}
public void testCloneComment() throws IOException {
@@ -120,15 +122,15 @@ public final class TestCloneSheet extends TestCase {
HSSFPatriarch p2 = sh2.getDrawingPatriarch();
HSSFComment c2 = (HSSFComment) p2.getChildren().get(0);
- assertTrue(Arrays.equals(c2.getTextObjectRecord().serialize(), c.getTextObjectRecord().serialize()));
- assertTrue(Arrays.equals(c2.getObjRecord().serialize(), c.getObjRecord().serialize()));
- assertTrue(Arrays.equals(c2.getNoteRecord().serialize(), c.getNoteRecord().serialize()));
+ assertArrayEquals(c2.getTextObjectRecord().serialize(), c.getTextObjectRecord().serialize());
+ assertArrayEquals(c2.getObjRecord().serialize(), c.getObjRecord().serialize());
+ assertArrayEquals(c2.getNoteRecord().serialize(), c.getNoteRecord().serialize());
//everything except spRecord.shapeId must be the same
assertFalse(Arrays.equals(c2.getEscherContainer().serialize(), c.getEscherContainer().serialize()));
EscherSpRecord sp = (EscherSpRecord) c2.getEscherContainer().getChild(0);
sp.setShapeId(1025);
- assertTrue(Arrays.equals(c2.getEscherContainer().serialize(), c.getEscherContainer().serialize()));
+ assertArrayEquals(c2.getEscherContainer().serialize(), c.getEscherContainer().serialize());
}
}
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java
index 1cd401fe70..056d17efcc 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java
@@ -17,7 +17,8 @@
package org.apache.poi.hssf.usermodel;
-import java.util.Arrays;
+import static org.junit.Assert.assertArrayEquals;
+
import java.util.Iterator;
import java.util.Map;
@@ -141,46 +142,34 @@ public final class TestHSSFPalette extends TestCase {
HSSFPalette p = book.getCustomPalette();
/* first test the defaults */
- assertTrue(
- Arrays.equals(
+ assertArrayEquals(
new short[] {(short) 255, (short) 255, (short) 0}, // not [204, 255, 255]
p.findSimilarColor((byte) 204, (byte) 255, (byte) 0).getTriplet()
- )
);
- assertTrue(
- Arrays.equals(
+ assertArrayEquals(
new short[] {(short) 153, (short) 204, (short) 0}, // not [128, 0, 0]
p.findSimilarColor((byte) 128, (byte) 255, (byte) 0).getTriplet()
- )
);
- assertTrue(
- Arrays.equals(
+ assertArrayEquals(
new short[] {(short) 0, (short) 255, (short) 0}, // not [0, 51, 102]
p.findSimilarColor((byte) 0, (byte) 255, (byte) 102).getTriplet()
- )
);
- assertTrue(
- Arrays.equals(
+ assertArrayEquals(
new short[] {(short) 0, (short) 102, (short) 204}, // not [255, 102, 0]
p.findSimilarColor((byte) 0, (byte) 102, (byte) 255).getTriplet()
- )
);
- assertTrue(
- Arrays.equals(
+ assertArrayEquals(
new short[] {(short) 255, (short) 0, (short) 255}, // not [128, 0, 0]
p.findSimilarColor((byte) 128, (byte) 0, (byte) 255).getTriplet()
- )
);
- assertTrue(
- Arrays.equals(
+ assertArrayEquals(
new short[] {(short) 255, (short) 0, (short) 255}, // not [255, 255, 153]
p.findSimilarColor((byte) 255, (byte) 0, (byte) 153).getTriplet()
- )
);
@@ -238,6 +227,7 @@ public final class TestHSSFPalette extends TestCase {
*/
public void testGnumericStrings() {
compareToDefaults(new ColorComparator() {
+ @Override
public void compare(HSSFColor expected, HSSFColor palette)
{
assertEquals(expected.getHexString(), palette.getHexString());
@@ -256,6 +246,7 @@ public final class TestHSSFPalette extends TestCase {
//should still match defaults;
compareToDefaults(new ColorComparator() {
+ @Override
public void compare(HSSFColor expected, HSSFColor palette)
{
short[] s1 = expected.getTriplet();
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java
index de2b683a7e..132a45af5c 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java
@@ -17,10 +17,9 @@
package org.apache.poi.hssf.usermodel;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
+import static org.junit.Assert.assertArrayEquals;
+
import java.io.IOException;
-import java.util.Arrays;
import java.util.List;
import org.apache.poi.POIDataSamples;
@@ -77,7 +76,7 @@ public final class TestHSSFPicture extends BaseTestPicture {
int idx1 = wb.addPicture(data1, Workbook.PICTURE_TYPE_JPEG);
assertEquals(1, idx1);
HSSFPicture p1 = dr.createPicture(anchor, idx1);
- assertTrue(Arrays.equals(data1, p1.getPictureData().getData()));
+ assertArrayEquals(data1, p1.getPictureData().getData());
// register another one
byte[] data2 = new byte[]{4, 5, 6};
@@ -85,25 +84,25 @@ public final class TestHSSFPicture extends BaseTestPicture {
assertEquals(2, idx2);
HSSFPicture p2 = dr.createPicture(anchor, idx2);
assertEquals(2, dr.getChildren().size());
- assertTrue(Arrays.equals(data2, p2.getPictureData().getData()));
+ assertArrayEquals(data2, p2.getPictureData().getData());
// confirm that HSSFPatriarch.getChildren() returns two picture shapes
- assertTrue(Arrays.equals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData()));
- assertTrue(Arrays.equals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData()));
+ assertArrayEquals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData());
+ assertArrayEquals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData());
// write, read back and verify that our pictures are there
wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
List<? extends PictureData> lst2 = wb.getAllPictures();
assertEquals(2, lst2.size());
- assertTrue(Arrays.equals(data1, lst2.get(0).getData()));
- assertTrue(Arrays.equals(data2, lst2.get(1).getData()));
+ assertArrayEquals(data1, lst2.get(0).getData());
+ assertArrayEquals(data2, lst2.get(1).getData());
// confirm that the pictures are in the Sheet's drawing
sh = wb.getSheet("Pictures");
dr = sh.createDrawingPatriarch();
assertEquals(2, dr.getChildren().size());
- assertTrue(Arrays.equals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData()));
- assertTrue(Arrays.equals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData()));
+ assertArrayEquals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData());
+ assertArrayEquals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData());
// add a third picture
byte[] data3 = new byte[]{7, 8, 9};
@@ -111,20 +110,20 @@ public final class TestHSSFPicture extends BaseTestPicture {
int idx3 = wb.addPicture(data3, Workbook.PICTURE_TYPE_JPEG);
assertEquals(3, idx3);
HSSFPicture p3 = dr.createPicture(anchor, idx3);
- assertTrue(Arrays.equals(data3, p3.getPictureData().getData()));
+ assertArrayEquals(data3, p3.getPictureData().getData());
assertEquals(3, dr.getChildren().size());
- assertTrue(Arrays.equals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData()));
- assertTrue(Arrays.equals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData()));
- assertTrue(Arrays.equals(data3, ((HSSFPicture)dr.getChildren().get(2)).getPictureData().getData()));
+ assertArrayEquals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData());
+ assertArrayEquals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData());
+ assertArrayEquals(data3, ((HSSFPicture)dr.getChildren().get(2)).getPictureData().getData());
// write and read again
wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
List<? extends PictureData> lst3 = wb.getAllPictures();
// all three should be there
assertEquals(3, lst3.size());
- assertTrue(Arrays.equals(data1, lst3.get(0).getData()));
- assertTrue(Arrays.equals(data2, lst3.get(1).getData()));
- assertTrue(Arrays.equals(data3, lst3.get(2).getData()));
+ assertArrayEquals(data1, lst3.get(0).getData());
+ assertArrayEquals(data2, lst3.get(1).getData());
+ assertArrayEquals(data3, lst3.get(2).getData());
sh = wb.getSheet("Pictures");
dr = sh.createDrawingPatriarch();
@@ -136,25 +135,25 @@ public final class TestHSSFPicture extends BaseTestPicture {
assertEquals(4, idx4);
dr.createPicture(anchor, idx4);
assertEquals(4, dr.getChildren().size());
- assertTrue(Arrays.equals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData()));
- assertTrue(Arrays.equals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData()));
- assertTrue(Arrays.equals(data3, ((HSSFPicture)dr.getChildren().get(2)).getPictureData().getData()));
- assertTrue(Arrays.equals(data4, ((HSSFPicture)dr.getChildren().get(3)).getPictureData().getData()));
+ assertArrayEquals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData());
+ assertArrayEquals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData());
+ assertArrayEquals(data3, ((HSSFPicture)dr.getChildren().get(2)).getPictureData().getData());
+ assertArrayEquals(data4, ((HSSFPicture)dr.getChildren().get(3)).getPictureData().getData());
wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
List<? extends PictureData> lst4 = wb.getAllPictures();
assertEquals(4, lst4.size());
- assertTrue(Arrays.equals(data1, lst4.get(0).getData()));
- assertTrue(Arrays.equals(data2, lst4.get(1).getData()));
- assertTrue(Arrays.equals(data3, lst4.get(2).getData()));
- assertTrue(Arrays.equals(data4, lst4.get(3).getData()));
+ assertArrayEquals(data1, lst4.get(0).getData());
+ assertArrayEquals(data2, lst4.get(1).getData());
+ assertArrayEquals(data3, lst4.get(2).getData());
+ assertArrayEquals(data4, lst4.get(3).getData());
sh = wb.getSheet("Pictures");
dr = sh.createDrawingPatriarch();
assertEquals(4, dr.getChildren().size());
- assertTrue(Arrays.equals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData()));
- assertTrue(Arrays.equals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData()));
- assertTrue(Arrays.equals(data3, ((HSSFPicture)dr.getChildren().get(2)).getPictureData().getData()));
- assertTrue(Arrays.equals(data4, ((HSSFPicture)dr.getChildren().get(3)).getPictureData().getData()));
+ assertArrayEquals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData());
+ assertArrayEquals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData());
+ assertArrayEquals(data3, ((HSSFPicture)dr.getChildren().get(2)).getPictureData().getData());
+ assertArrayEquals(data4, ((HSSFPicture)dr.getChildren().get(3)).getPictureData().getData());
}
public void testBSEPictureRef(){
@@ -256,12 +255,12 @@ public final class TestHSSFPicture extends BaseTestPicture {
wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
byte pictureDataOut[] = wb.getAllPictures().get(0).getData();
- assertTrue(Arrays.equals(pictureDataEmf, pictureDataOut));
+ assertArrayEquals(pictureDataEmf, pictureDataOut);
byte wmfNoHeader[] = new byte[pictureDataWmf.length-22];
System.arraycopy(pictureDataWmf, 22, wmfNoHeader, 0, pictureDataWmf.length-22);
pictureDataOut = wb.getAllPictures().get(2).getData();
- assertTrue(Arrays.equals(wmfNoHeader, pictureDataOut));
+ assertArrayEquals(wmfNoHeader, pictureDataOut);
}
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java b/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java
index 22700b28cc..e425acc1e4 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java
@@ -17,12 +17,13 @@
package org.apache.poi.hssf.usermodel;
+import static org.junit.Assert.assertArrayEquals;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Arrays;
import java.util.List;
import junit.framework.TestCase;
@@ -119,17 +120,17 @@ public final class TestOLE2Embeding extends TestCase {
Ole10Native ole10 = Ole10Native.createFromEmbeddedOleObject((DirectoryNode)od.getDirectory());
bos.reset();
pptPoifs.writeFilesystem(bos);
- assertTrue(Arrays.equals(ole10.getDataBuffer(), bos.toByteArray()));
+ assertArrayEquals(ole10.getDataBuffer(), bos.toByteArray());
od = wb.getAllEmbeddedObjects().get(1);
ole10 = Ole10Native.createFromEmbeddedOleObject((DirectoryNode)od.getDirectory());
bos.reset();
xlsPoifs.writeFilesystem(bos);
- assertTrue(Arrays.equals(ole10.getDataBuffer(), bos.toByteArray()));
+ assertArrayEquals(ole10.getDataBuffer(), bos.toByteArray());
od = wb.getAllEmbeddedObjects().get(2);
ole10 = Ole10Native.createFromEmbeddedOleObject((DirectoryNode)od.getDirectory());
- assertTrue(Arrays.equals(ole10.getDataBuffer(), getSampleTXT()));
+ assertArrayEquals(ole10.getDataBuffer(), getSampleTXT());
}
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestPolygon.java b/src/testcases/org/apache/poi/hssf/usermodel/TestPolygon.java
index e677f97ec9..bcaf477493 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestPolygon.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestPolygon.java
@@ -17,7 +17,12 @@
package org.apache.poi.hssf.usermodel;
+import static org.junit.Assert.assertArrayEquals;
+
+import java.io.IOException;
+
import junit.framework.TestCase;
+
import org.apache.poi.ddf.EscherArrayProperty;
import org.apache.poi.ddf.EscherOptRecord;
import org.apache.poi.ddf.EscherProperties;
@@ -27,9 +32,6 @@ import org.apache.poi.hssf.model.HSSFTestModelHelper;
import org.apache.poi.hssf.model.PolygonShape;
import org.apache.poi.hssf.record.ObjRecord;
-import java.io.IOException;
-import java.util.Arrays;
-
/**
* @author Evgeniy Berlog
* @date 28.06.12
@@ -55,19 +57,19 @@ public class TestPolygon extends TestCase{
byte[] actual = polygon.getEscherContainer().getChild(0).serialize();
assertEquals(expected.length, actual.length);
- assertTrue(Arrays.equals(expected, actual));
+ assertArrayEquals(expected, actual);
expected = polygonShape.getSpContainer().getChild(2).serialize();
actual = polygon.getEscherContainer().getChild(2).serialize();
assertEquals(expected.length, actual.length);
- assertTrue(Arrays.equals(expected, actual));
+ assertArrayEquals(expected, actual);
expected = polygonShape.getSpContainer().getChild(3).serialize();
actual = polygon.getEscherContainer().getChild(3).serialize();
assertEquals(expected.length, actual.length);
- assertTrue(Arrays.equals(expected, actual));
+ assertArrayEquals(expected, actual);
ObjRecord obj = polygon.getObjRecord();
ObjRecord objShape = polygonShape.getObjRecord();
@@ -76,7 +78,7 @@ public class TestPolygon extends TestCase{
actual = objShape.serialize();
assertEquals(expected.length, actual.length);
- assertTrue(Arrays.equals(expected, actual));
+ assertArrayEquals(expected, actual);
}
public void testPolygonPoints(){
@@ -98,8 +100,8 @@ public class TestPolygon extends TestCase{
assertEquals(verticesProp1.toXml(""), verticesProp2.toXml(""));
polygon.setPoints(new int[]{1,2,3}, new int[] {4,5,6});
- assertTrue(Arrays.equals(polygon.getXPoints(), new int[]{1, 2, 3}));
- assertTrue(Arrays.equals(polygon.getYPoints(), new int[]{4, 5, 6}));
+ assertArrayEquals(polygon.getXPoints(), new int[]{1, 2, 3});
+ assertArrayEquals(polygon.getYPoints(), new int[]{4, 5, 6});
polygonShape = HSSFTestModelHelper.createPolygonShape(0, polygon);
verticesProp1 = polygon.getOptRecord().lookup(EscherProperties.GEOMETRY__VERTICES);
@@ -119,8 +121,8 @@ public class TestPolygon extends TestCase{
polygon.setPolygonDrawArea( 102, 101 );
polygon.setPoints( new int[]{1,2,3}, new int[]{4,5,6} );
- assertTrue(Arrays.equals(polygon.getXPoints(), new int[]{1,2,3}));
- assertTrue(Arrays.equals(polygon.getYPoints(), new int[]{4, 5, 6}));
+ assertArrayEquals(polygon.getXPoints(), new int[]{1,2,3});
+ assertArrayEquals(polygon.getYPoints(), new int[]{4, 5, 6});
assertEquals(polygon.getDrawAreaHeight(), 101);
assertEquals(polygon.getDrawAreaWidth(), 102);
@@ -129,16 +131,16 @@ public class TestPolygon extends TestCase{
patriarch = sh.getDrawingPatriarch();
polygon = (HSSFPolygon) patriarch.getChildren().get(0);
- assertTrue(Arrays.equals(polygon.getXPoints(), new int[]{1, 2, 3}));
- assertTrue(Arrays.equals(polygon.getYPoints(), new int[]{4, 5, 6}));
+ assertArrayEquals(polygon.getXPoints(), new int[]{1, 2, 3});
+ assertArrayEquals(polygon.getYPoints(), new int[]{4, 5, 6});
assertEquals(polygon.getDrawAreaHeight(), 101);
assertEquals(polygon.getDrawAreaWidth(), 102);
polygon.setPolygonDrawArea( 1021, 1011 );
polygon.setPoints( new int[]{11,21,31}, new int[]{41,51,61} );
- assertTrue(Arrays.equals(polygon.getXPoints(), new int[]{11, 21, 31}));
- assertTrue(Arrays.equals(polygon.getYPoints(), new int[]{41, 51, 61}));
+ assertArrayEquals(polygon.getXPoints(), new int[]{11, 21, 31});
+ assertArrayEquals(polygon.getYPoints(), new int[]{41, 51, 61});
assertEquals(polygon.getDrawAreaHeight(), 1011);
assertEquals(polygon.getDrawAreaWidth(), 1021);
@@ -148,8 +150,8 @@ public class TestPolygon extends TestCase{
polygon = (HSSFPolygon) patriarch.getChildren().get(0);
- assertTrue(Arrays.equals(polygon.getXPoints(), new int[]{11, 21, 31}));
- assertTrue(Arrays.equals(polygon.getYPoints(), new int[]{41, 51, 61}));
+ assertArrayEquals(polygon.getXPoints(), new int[]{11, 21, 31});
+ assertArrayEquals(polygon.getYPoints(), new int[]{41, 51, 61});
assertEquals(polygon.getDrawAreaHeight(), 1011);
assertEquals(polygon.getDrawAreaWidth(), 1021);
}
@@ -187,18 +189,18 @@ public class TestPolygon extends TestCase{
polygon1 = (HSSFPolygon) patriarch.getChildren().get(1);
polygon2 = (HSSFPolygon) patriarch.getChildren().get(2);
- assertTrue(Arrays.equals(polygon.getXPoints(), new int[]{1, 2, 3}));
- assertTrue(Arrays.equals(polygon.getYPoints(), new int[]{4,5,6}));
+ assertArrayEquals(polygon.getXPoints(), new int[]{1, 2, 3});
+ assertArrayEquals(polygon.getYPoints(), new int[]{4,5,6});
assertEquals(polygon.getDrawAreaHeight(), 101);
assertEquals(polygon.getDrawAreaWidth(), 102);
- assertTrue(Arrays.equals(polygon1.getXPoints(), new int[]{11,12,13}));
- assertTrue(Arrays.equals(polygon1.getYPoints(), new int[]{14,15,16}));
+ assertArrayEquals(polygon1.getXPoints(), new int[]{11,12,13});
+ assertArrayEquals(polygon1.getYPoints(), new int[]{14,15,16});
assertEquals(polygon1.getDrawAreaHeight(), 104);
assertEquals(polygon1.getDrawAreaWidth(), 103);
- assertTrue(Arrays.equals(polygon2.getXPoints(), new int[]{21,22,23}));
- assertTrue(Arrays.equals(polygon2.getYPoints(), new int[]{24,25,26}));
+ assertArrayEquals(polygon2.getXPoints(), new int[]{21,22,23});
+ assertArrayEquals(polygon2.getYPoints(), new int[]{24,25,26});
assertEquals(polygon2.getDrawAreaHeight(), 204);
assertEquals(polygon2.getDrawAreaWidth(), 203);
}
@@ -212,8 +214,8 @@ public class TestPolygon extends TestCase{
HSSFPolygon polygon = (HSSFPolygon) drawing.getChildren().get(0);
assertEquals(polygon.getDrawAreaHeight(), 2466975);
assertEquals(polygon.getDrawAreaWidth(), 3686175);
- assertTrue(Arrays.equals(polygon.getXPoints(), new int[]{0, 0, 31479, 16159, 19676, 20502}));
- assertTrue(Arrays.equals(polygon.getYPoints(), new int[]{0, 0, 36, 56, 34, 18}));
+ assertArrayEquals(polygon.getXPoints(), new int[]{0, 0, 31479, 16159, 19676, 20502});
+ assertArrayEquals(polygon.getYPoints(), new int[]{0, 0, 36, 56, 34, 18});
}
public void testPolygonType(){
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestText.java b/src/testcases/org/apache/poi/hssf/usermodel/TestText.java
index 07c039edd3..7231330ee0 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestText.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestText.java
@@ -17,15 +17,15 @@
package org.apache.poi.hssf.usermodel;
+import static org.junit.Assert.assertArrayEquals;
import junit.framework.TestCase;
+
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.hssf.model.HSSFTestModelHelper;
import org.apache.poi.hssf.model.TextboxShape;
import org.apache.poi.hssf.record.ObjRecord;
import org.apache.poi.hssf.record.TextObjectRecord;
-import java.util.Arrays;
-
/**
* @author Evgeniy Berlog
* @date 25.06.12
@@ -47,25 +47,25 @@ public class TestText extends TestCase {
byte[] actual = textbox.getEscherContainer().getChild(0).serialize();
assertEquals(expected.length, actual.length);
- assertTrue(Arrays.equals(expected, actual));
+ assertArrayEquals(expected, actual);
expected = textboxShape.getSpContainer().getChild(2).serialize();
actual = textbox.getEscherContainer().getChild(2).serialize();
assertEquals(expected.length, actual.length);
- assertTrue(Arrays.equals(expected, actual));
+ assertArrayEquals(expected, actual);
expected = textboxShape.getSpContainer().getChild(3).serialize();
actual = textbox.getEscherContainer().getChild(3).serialize();
assertEquals(expected.length, actual.length);
- assertTrue(Arrays.equals(expected, actual));
+ assertArrayEquals(expected, actual);
expected = textboxShape.getSpContainer().getChild(4).serialize();
actual = textbox.getEscherContainer().getChild(4).serialize();
assertEquals(expected.length, actual.length);
- assertTrue(Arrays.equals(expected, actual));
+ assertArrayEquals(expected, actual);
ObjRecord obj = textbox.getObjRecord();
ObjRecord objShape = textboxShape.getObjRecord();
@@ -80,7 +80,7 @@ public class TestText extends TestCase {
actual = torShape.serialize();
assertEquals(expected.length, actual.length);
- assertTrue(Arrays.equals(expected, actual));
+ assertArrayEquals(expected, actual);
}
public void testAddTextToExistingFile() {
diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestArrayPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestArrayPtg.java
index 386ba37f50..36783a4c50 100644
--- a/src/testcases/org/apache/poi/ss/formula/ptg/TestArrayPtg.java
+++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestArrayPtg.java
@@ -17,8 +17,7 @@
package org.apache.poi.ss.formula.ptg;
-import java.util.Arrays;
-
+import static org.junit.Assert.assertArrayEquals;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
@@ -77,7 +76,7 @@ public final class TestArrayPtg extends TestCase {
if(outBuf[0] == 4) {
throw new AssertionFailedError("Identified bug 42564b");
}
- assertTrue(Arrays.equals(ENCODED_CONSTANT_DATA, outBuf));
+ assertArrayEquals(ENCODED_CONSTANT_DATA, outBuf);
}
diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestAttrPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestAttrPtg.java
index fb517a31d1..6146449fcc 100644
--- a/src/testcases/org/apache/poi/ss/formula/ptg/TestAttrPtg.java
+++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestAttrPtg.java
@@ -17,8 +17,7 @@
package org.apache.poi.ss.formula.ptg;
-import java.util.Arrays;
-
+import static org.junit.Assert.assertArrayEquals;
import junit.framework.AssertionFailedError;
import org.apache.poi.hssf.record.TestcaseRecordInputStream;
@@ -45,6 +44,6 @@ public final class TestAttrPtg extends AbstractPtgTestCase {
} catch (ArrayIndexOutOfBoundsException e) {
throw new AssertionFailedError("incorrect re-serialization of tAttrChoose");
}
- assertTrue(Arrays.equals(data, data2));
+ assertArrayEquals(data, data2);
}
}
diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestReferencePtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestReferencePtg.java
index db02279f39..7167c2ec09 100644
--- a/src/testcases/org/apache/poi/ss/formula/ptg/TestReferencePtg.java
+++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestReferencePtg.java
@@ -17,8 +17,7 @@
package org.apache.poi.ss.formula.ptg;
-import java.util.Arrays;
-
+import static org.junit.Assert.assertArrayEquals;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
@@ -101,7 +100,7 @@ public final class TestReferencePtg extends TestCase {
if (outData[0] == 0x24) {
throw new AssertionFailedError("Identified bug 45091");
}
- assertTrue(Arrays.equals(tRefN_data, outData));
+ assertArrayEquals(tRefN_data, outData);
}
/**
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java
index 3c177e6aff..4bea4a8c78 100644
--- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java
+++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetUpdateArrayFormulas.java
@@ -17,8 +17,7 @@
package org.apache.poi.ss.usermodel;
-import java.util.Arrays;
-
+import static org.junit.Assert.assertArrayEquals;
import junit.framework.TestCase;
import org.apache.poi.ss.ITestDataProvider;
@@ -179,7 +178,7 @@ public abstract class BaseTestSheetUpdateArrayFormulas extends TestCase {
// remove the formula cells in C4:C6
CellRange<?> dcells = sheet.removeArrayFormula(cr.getTopLeftCell());
// removeArrayFormula should return the same cells as setArrayFormula
- assertTrue(Arrays.equals(cr.getFlattenedCells(), dcells.getFlattenedCells()));
+ assertArrayEquals(cr.getFlattenedCells(), dcells.getFlattenedCells());
for(Cell acell : cr){
assertFalse(acell.isPartOfArrayFormulaGroup());
diff --git a/src/testcases/org/apache/poi/util/TestLittleEndianStreams.java b/src/testcases/org/apache/poi/util/TestLittleEndianStreams.java
index 26f9b4cf6b..6e7b30f741 100644
--- a/src/testcases/org/apache/poi/util/TestLittleEndianStreams.java
+++ b/src/testcases/org/apache/poi/util/TestLittleEndianStreams.java
@@ -17,9 +17,10 @@
package org.apache.poi.util;
+import static org.junit.Assert.assertArrayEquals;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.util.Arrays;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
@@ -73,7 +74,7 @@ public final class TestLittleEndianStreams extends TestCase {
}
byte[] expBuf = HexRead.readFromString("77 66 55 44");
- assertTrue(Arrays.equals(actBuf, expBuf));
+ assertArrayEquals(actBuf, expBuf);
assertEquals(0x33, lei.readUByte());
assertEquals(0, lei.available());
}