summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2012-09-02 00:15:53 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2012-09-03 22:37:58 +0200
commitcd23b214bf2564c0f41f7c3f89a2bf48ec308547 (patch)
treede97794632829be92b80c50e6cccc9d8bb3f82c2 /org.eclipse.jgit.test/tst
parent476e1d2ff1cc1e57fe75d26f0bf679fc44325bd8 (diff)
downloadjgit-cd23b214bf2564c0f41f7c3f89a2bf48ec308547.tar.gz
jgit-cd23b214bf2564c0f41f7c3f89a2bf48ec308547.zip
cleanup: use assertArrayEquals for assertion on arrays
Change-Id: I1df945011f8e5f03959b693d3564fe357e707f91
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java4
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java3
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConstantsEncodingTest.java12
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/ConcurrentRepackTest.java6
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackFileTest.java3
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/pack/DeltaIndexTest.java5
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/pack/DeltaStreamTest.java3
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java42
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutInputStreamTest.java5
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java5
10 files changed, 43 insertions, 45 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java
index 634b43a2e0..e14190b53d 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java
@@ -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,
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
index 700ab35883..63f9476d96 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
@@ -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());
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConstantsEncodingTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConstantsEncodingTest.java
index 114d9da905..4db6f6da2e 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConstantsEncodingTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConstantsEncodingTest.java
@@ -43,13 +43,11 @@
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"));
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/ConcurrentRepackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/ConcurrentRepackTest.java
index 0a5e9feb81..2868d5c0d8 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/ConcurrentRepackTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/ConcurrentRepackTest.java
@@ -44,19 +44,17 @@
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());
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackFileTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackFileTest.java
index 2e197f10b6..ca46da2a62 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackFileTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackFileTest.java
@@ -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);
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/pack/DeltaIndexTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/pack/DeltaIndexTest.java
index 5da56ae3d6..59acaf62b0 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/pack/DeltaIndexTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/pack/DeltaIndexTest.java
@@ -43,14 +43,13 @@
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));
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/pack/DeltaStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/pack/DeltaStreamTest.java
index 62842a87f7..9b39d79735 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/pack/DeltaStreamTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/pack/DeltaStreamTest.java
@@ -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.
//
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java
index eb4fb1e87d..8b67532a97 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java
@@ -44,17 +44,15 @@
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();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutInputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutInputStreamTest.java
index 21aab06906..45ebefb549 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutInputStreamTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutInputStreamTest.java
@@ -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
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java
index f4d1ad5ae8..a63b1cb02a 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java
@@ -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