]> source.dussan.org Git - jgit.git/commitdiff
cleanup: use assertArrayEquals for assertion on arrays 67/7567/5
authorRobin Rosenberg <robin.rosenberg@dewire.com>
Sat, 1 Sep 2012 22:15:53 +0000 (00:15 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Mon, 3 Sep 2012 20:37:58 +0000 (22:37 +0200)
Change-Id: I1df945011f8e5f03959b693d3564fe357e707f91

org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConstantsEncodingTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/ConcurrentRepackTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackFileTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/pack/DeltaIndexTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/pack/DeltaStreamTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutInputStreamTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java

index 634b43a2e046e5cc17043382a788f84309e44e12..e14190b53d7743968e41f07f221bfac1592b0f8c 100644 (file)
@@ -43,6 +43,7 @@
 
 package org.eclipse.jgit.dircache;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
@@ -54,7 +55,6 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStreamReader;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
@@ -215,7 +215,7 @@ public class DirCacheCGitCompatabilityTest extends LocalDiskRepositoryTestCase {
                dc.writeTo(bos);
                final byte[] indexBytes = bos.toByteArray();
                final byte[] expectedBytes = IO.readFully(file);
-               assertTrue(Arrays.equals(expectedBytes, indexBytes));
+               assertArrayEquals(expectedBytes, indexBytes);
        }
 
        private static void assertV3TreeEntry(int indexPosition, String path,
index 700ab358832b9a29ba73115e18b778eda530733c..63f9476d963b87701e1bfdb0271da52ee3443118 100644 (file)
@@ -48,6 +48,7 @@
 
 package org.eclipse.jgit.lib;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -117,7 +118,7 @@ public class ConfigTest {
 
                final Object[] expArr = values.toArray();
                final String[] actArr = c.getStringList("my", null, "somename");
-               assertTrue(Arrays.equals(expArr, actArr));
+               assertArrayEquals(expArr, actArr);
 
                final String expText = "[my]\n\tsomename = value1\n\tsomename = value2\n";
                assertEquals(expText, c.toText());
index 114d9da905f4ef66b874d10d40de64d418dd5e4d..4db6f6da2e71ce02e1cf85f1922cdb517df08f07 100644 (file)
 
 package org.eclipse.jgit.lib;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.io.UnsupportedEncodingException;
-import java.util.Arrays;
-
 import org.junit.Test;
 
 public class ConstantsEncodingTest {
@@ -59,7 +57,7 @@ public class ConstantsEncodingTest {
                final String src = "abc";
                final byte[] exp = { 'a', 'b', 'c' };
                final byte[] res = Constants.encodeASCII(src);
-               assertTrue(Arrays.equals(exp, res));
+               assertArrayEquals(exp, res);
                assertEquals(src, new String(res, 0, res.length, "UTF-8"));
        }
 
@@ -79,7 +77,7 @@ public class ConstantsEncodingTest {
                final long src = 13;
                final byte[] exp = { '1', '3' };
                final byte[] res = Constants.encodeASCII(src);
-               assertTrue(Arrays.equals(exp, res));
+               assertArrayEquals(exp, res);
        }
 
        @Test
@@ -87,7 +85,7 @@ public class ConstantsEncodingTest {
                final String src = "abc";
                final byte[] exp = { 'a', 'b', 'c' };
                final byte[] res = Constants.encode(src);
-               assertTrue(Arrays.equals(exp, res));
+               assertArrayEquals(exp, res);
                assertEquals(src, new String(res, 0, res.length, "UTF-8"));
        }
 
@@ -98,7 +96,7 @@ public class ConstantsEncodingTest {
                                (byte) 0xAD, 0x63, (byte) 0xC5, (byte) 0x8D, 0x64, 0x65,
                                (byte) 0xCC, (byte) 0xBD };
                final byte[] res = Constants.encode(src);
-               assertTrue(Arrays.equals(exp, res));
+               assertArrayEquals(exp, res);
                assertEquals(src, new String(res, 0, res.length, "UTF-8"));
        }
 }
index 0a5e9feb81daeb6b109ad4623cc9ecec47acaa73..2868d5c0d8a932d491667451463199120ad02bb0 100644 (file)
 
 package org.eclipse.jgit.storage.file;
 
+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.assertNotSame;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.util.Arrays;
-
 import org.eclipse.jgit.errors.IncorrectObjectTypeException;
 import org.eclipse.jgit.errors.MissingObjectException;
 import org.eclipse.jgit.lib.AnyObjectId;
@@ -199,7 +197,7 @@ public class ConcurrentRepackTest extends RepositoryTestCase {
                assertNotNull(data2);
                assertNotNull(data1);
                assertNotSame(data1, data2); // cache should be per-pack, not per object
-               assertTrue(Arrays.equals(data1, data2));
+               assertArrayEquals(data1, data2);
                assertEquals(load2.getType(), load1.getType());
        }
 
index 2e197f10b65efb0f7d9c76a81d834a70b6f4f207..ca46da2a628ca4f6fbd2279af18b93b782c040db 100644 (file)
@@ -43,6 +43,7 @@
 
 package org.eclipse.jgit.storage.file;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -224,7 +225,7 @@ public class PackFileTest extends LocalDiskRepositoryTestCase {
                assertEquals(data3.length, ol.getSize());
                assertFalse("is large", ol.isLarge());
                assertNotNull(ol.getCachedBytes());
-               assertTrue(Arrays.equals(data3, ol.getCachedBytes()));
+               assertArrayEquals(data3, ol.getCachedBytes());
 
                ObjectStream in = ol.openStream();
                assertNotNull("have stream", in);
index 5da56ae3d62951fe1150e1c0aba58c48b3de950d..59acaf62b00855dde3a249ba9d92143f0bfb4bbc 100644 (file)
 
 package org.eclipse.jgit.storage.pack;
 
+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 java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.util.Arrays;
-
 import org.eclipse.jgit.junit.JGitTestUtil;
 import org.eclipse.jgit.junit.TestRng;
 import org.eclipse.jgit.lib.Constants;
@@ -246,6 +245,6 @@ public class DeltaIndexTest {
                assertTrue("delta is not empty", actDelta.length > 0);
                assertEquals(src.length, BinaryDelta.getBaseSize(actDelta));
                assertEquals(dst.length, BinaryDelta.getResultSize(actDelta));
-               assertTrue(Arrays.equals(dst, BinaryDelta.apply(src, actDelta)));
+               assertArrayEquals(dst, BinaryDelta.apply(src, actDelta));
        }
 }
index 62842a87f7198981175444c931936d12c299f3cf..9b39d797357887dab2cd483fce94197b9712de5f 100644 (file)
@@ -43,6 +43,7 @@
 
 package org.eclipse.jgit.storage.pack;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -267,7 +268,7 @@ public class DeltaStreamTest {
                delta = deltaBuf.toByteArray();
                assertEquals(base.length, BinaryDelta.getBaseSize(delta));
                assertEquals(data.length, BinaryDelta.getResultSize(delta));
-               assertTrue(Arrays.equals(data, BinaryDelta.apply(base, delta)));
+               assertArrayEquals(data, BinaryDelta.apply(base, delta));
 
                // Assert that a single bulk read produces the correct result.
                //
index eb4fb1e87dcd35cd8724f29d155178043c1e135d..8b67532a97351ab5ca421071f877c214c7421f72 100644 (file)
 package org.eclipse.jgit.util;
 
 import static org.eclipse.jgit.junit.JGitTestUtil.getName;
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.Arrays;
-
 import org.eclipse.jgit.junit.TestRng;
 import org.junit.Test;
 
@@ -116,7 +114,7 @@ public class TemporaryBufferTest {
                                final byte[] r = b.toByteArray();
                                assertNotNull(r);
                                assertEquals(test.length, r.length);
-                               assertTrue(Arrays.equals(test, r));
+                               assertArrayEquals(test, r);
                        }
                        {
                                final ByteArrayOutputStream o = new ByteArrayOutputStream();
@@ -124,7 +122,7 @@ public class TemporaryBufferTest {
                                o.close();
                                final byte[] r = o.toByteArray();
                                assertEquals(test.length, r.length);
-                               assertTrue(Arrays.equals(test, r));
+                               assertArrayEquals(test, r);
                        }
                } finally {
                        b.destroy();
@@ -147,7 +145,7 @@ public class TemporaryBufferTest {
                                final byte[] r = b.toByteArray();
                                assertNotNull(r);
                                assertEquals(test.length, r.length);
-                               assertTrue(Arrays.equals(test, r));
+                               assertArrayEquals(test, r);
                        }
                        {
                                final ByteArrayOutputStream o = new ByteArrayOutputStream();
@@ -155,7 +153,7 @@ public class TemporaryBufferTest {
                                o.close();
                                final byte[] r = o.toByteArray();
                                assertEquals(test.length, r.length);
-                               assertTrue(Arrays.equals(test, r));
+                               assertArrayEquals(test, r);
                        }
                } finally {
                        b.destroy();
@@ -176,7 +174,7 @@ public class TemporaryBufferTest {
                                final byte[] r = b.toByteArray();
                                assertNotNull(r);
                                assertEquals(test.length, r.length);
-                               assertTrue(Arrays.equals(test, r));
+                               assertArrayEquals(test, r);
                        }
                        {
                                final ByteArrayOutputStream o = new ByteArrayOutputStream();
@@ -184,7 +182,7 @@ public class TemporaryBufferTest {
                                o.close();
                                final byte[] r = o.toByteArray();
                                assertEquals(test.length, r.length);
-                               assertTrue(Arrays.equals(test, r));
+                               assertArrayEquals(test, r);
                        }
                } finally {
                        b.destroy();
@@ -206,7 +204,7 @@ public class TemporaryBufferTest {
                                final byte[] r = b.toByteArray();
                                assertNotNull(r);
                                assertEquals(test.length, r.length);
-                               assertTrue(Arrays.equals(test, r));
+                               assertArrayEquals(test, r);
                        }
                        {
                                final ByteArrayOutputStream o = new ByteArrayOutputStream();
@@ -214,7 +212,7 @@ public class TemporaryBufferTest {
                                o.close();
                                final byte[] r = o.toByteArray();
                                assertEquals(test.length, r.length);
-                               assertTrue(Arrays.equals(test, r));
+                               assertArrayEquals(test, r);
                        }
                } finally {
                        b.destroy();
@@ -234,7 +232,7 @@ public class TemporaryBufferTest {
                                final byte[] r = b.toByteArray();
                                assertNotNull(r);
                                assertEquals(test.length, r.length);
-                               assertTrue(Arrays.equals(test, r));
+                               assertArrayEquals(test, r);
                        }
                        {
                                final ByteArrayOutputStream o = new ByteArrayOutputStream();
@@ -242,7 +240,7 @@ public class TemporaryBufferTest {
                                o.close();
                                final byte[] r = o.toByteArray();
                                assertEquals(test.length, r.length);
-                               assertTrue(Arrays.equals(test, r));
+                               assertArrayEquals(test, r);
                        }
                } finally {
                        b.destroy();
@@ -260,7 +258,7 @@ public class TemporaryBufferTest {
                InputStream in = b.openInputStream();
                byte[] act = new byte[cnt];
                IO.readFully(in, act, 0, cnt);
-               assertTrue(Arrays.equals(test, act));
+               assertArrayEquals(test, act);
        }
 
        @Test
@@ -277,7 +275,7 @@ public class TemporaryBufferTest {
                                final byte[] r = b.toByteArray();
                                assertNotNull(r);
                                assertEquals(test.length, r.length);
-                               assertTrue(Arrays.equals(test, r));
+                               assertArrayEquals(test, r);
                        }
                        {
                                final ByteArrayOutputStream o = new ByteArrayOutputStream();
@@ -285,7 +283,7 @@ public class TemporaryBufferTest {
                                o.close();
                                final byte[] r = o.toByteArray();
                                assertEquals(test.length, r.length);
-                               assertTrue(Arrays.equals(test, r));
+                               assertArrayEquals(test, r);
                        }
                } finally {
                        b.destroy();
@@ -306,7 +304,7 @@ public class TemporaryBufferTest {
                                final byte[] r = b.toByteArray();
                                assertNotNull(r);
                                assertEquals(test.length, r.length);
-                               assertTrue(Arrays.equals(test, r));
+                               assertArrayEquals(test, r);
                        }
                        {
                                final ByteArrayOutputStream o = new ByteArrayOutputStream();
@@ -314,7 +312,7 @@ public class TemporaryBufferTest {
                                o.close();
                                final byte[] r = o.toByteArray();
                                assertEquals(test.length, r.length);
-                               assertTrue(Arrays.equals(test, r));
+                               assertArrayEquals(test, r);
                        }
                } finally {
                        b.destroy();
@@ -338,7 +336,7 @@ public class TemporaryBufferTest {
                                final byte[] r = b.toByteArray();
                                assertNotNull(r);
                                assertEquals(test.length, r.length);
-                               assertTrue(Arrays.equals(test, r));
+                               assertArrayEquals(test, r);
                        }
                        {
                                final ByteArrayOutputStream o = new ByteArrayOutputStream();
@@ -346,7 +344,7 @@ public class TemporaryBufferTest {
                                o.close();
                                final byte[] r = o.toByteArray();
                                assertEquals(test.length, r.length);
-                               assertTrue(Arrays.equals(test, r));
+                               assertArrayEquals(test, r);
                        }
                } finally {
                        b.destroy();
@@ -396,7 +394,7 @@ public class TemporaryBufferTest {
                                final byte[] r = b.toByteArray();
                                assertNotNull(r);
                                assertEquals(expect.length, r.length);
-                               assertTrue(Arrays.equals(expect, r));
+                               assertArrayEquals(expect, r);
                        }
                        {
                                final ByteArrayOutputStream o = new ByteArrayOutputStream();
@@ -404,7 +402,7 @@ public class TemporaryBufferTest {
                                o.close();
                                final byte[] r = o.toByteArray();
                                assertEquals(expect.length, r.length);
-                               assertTrue(Arrays.equals(expect, r));
+                               assertArrayEquals(expect, r);
                        }
                } finally {
                        b.destroy();
index 21aab069068f412f54e48b17fb8ee1b3988950c0..45ebefb5493909299702b379efaac54c1a1dd55a 100644 (file)
@@ -43,6 +43,7 @@
 
 package org.eclipse.jgit.util.io;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -124,7 +125,7 @@ public class TimeoutInputStreamTest {
                final byte[] act = new byte[exp.length];
                out.write(exp);
                IO.readFully(is, act, 0, act.length);
-               assertTrue(Arrays.equals(exp, act));
+               assertArrayEquals(exp, act);
        }
 
        @Test
@@ -135,7 +136,7 @@ public class TimeoutInputStreamTest {
                IO.readFully(is, act, 0, 1);
                IO.readFully(is, act, 1, 1);
                IO.readFully(is, act, 2, 1);
-               assertTrue(Arrays.equals(exp, act));
+               assertArrayEquals(exp, act);
        }
 
        @Test
index f4d1ad5ae8f24f3a666b378917003fb98a3d527d..a63b1cb02ace1715447daea75b3d598d525acb22 100644 (file)
@@ -43,6 +43,7 @@
 
 package org.eclipse.jgit.util.io;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -108,7 +109,7 @@ public class TimeoutOutputStreamTest {
                os.write(exp[2]);
                in.want(exp.length);
                in.read(act);
-               assertTrue(Arrays.equals(exp, act));
+               assertArrayEquals(exp, act);
        }
 
        @Test
@@ -131,7 +132,7 @@ public class TimeoutOutputStreamTest {
                os.write(exp);
                in.want(exp.length);
                in.read(act);
-               assertTrue(Arrays.equals(exp, act));
+               assertArrayEquals(exp, act);
        }
 
        @Test