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;
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;
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,
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;
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());
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 {
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"));
}
final long src = 13;
final byte[] exp = { '1', '3' };
final byte[] res = Constants.encodeASCII(src);
- assertTrue(Arrays.equals(exp, res));
+ assertArrayEquals(exp, res);
}
@Test
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"));
}
(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"));
}
}
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;
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());
}
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;
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);
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;
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));
}
}
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;
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.
//
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;
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();
o.close();
final byte[] r = o.toByteArray();
assertEquals(test.length, r.length);
- assertTrue(Arrays.equals(test, r));
+ assertArrayEquals(test, r);
}
} finally {
b.destroy();
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();
o.close();
final byte[] r = o.toByteArray();
assertEquals(test.length, r.length);
- assertTrue(Arrays.equals(test, r));
+ assertArrayEquals(test, r);
}
} finally {
b.destroy();
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();
o.close();
final byte[] r = o.toByteArray();
assertEquals(test.length, r.length);
- assertTrue(Arrays.equals(test, r));
+ assertArrayEquals(test, r);
}
} finally {
b.destroy();
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();
o.close();
final byte[] r = o.toByteArray();
assertEquals(test.length, r.length);
- assertTrue(Arrays.equals(test, r));
+ assertArrayEquals(test, r);
}
} finally {
b.destroy();
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();
o.close();
final byte[] r = o.toByteArray();
assertEquals(test.length, r.length);
- assertTrue(Arrays.equals(test, r));
+ assertArrayEquals(test, r);
}
} finally {
b.destroy();
InputStream in = b.openInputStream();
byte[] act = new byte[cnt];
IO.readFully(in, act, 0, cnt);
- assertTrue(Arrays.equals(test, act));
+ assertArrayEquals(test, act);
}
@Test
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();
o.close();
final byte[] r = o.toByteArray();
assertEquals(test.length, r.length);
- assertTrue(Arrays.equals(test, r));
+ assertArrayEquals(test, r);
}
} finally {
b.destroy();
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();
o.close();
final byte[] r = o.toByteArray();
assertEquals(test.length, r.length);
- assertTrue(Arrays.equals(test, r));
+ assertArrayEquals(test, r);
}
} finally {
b.destroy();
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();
o.close();
final byte[] r = o.toByteArray();
assertEquals(test.length, r.length);
- assertTrue(Arrays.equals(test, r));
+ assertArrayEquals(test, r);
}
} finally {
b.destroy();
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();
o.close();
final byte[] r = o.toByteArray();
assertEquals(expect.length, r.length);
- assertTrue(Arrays.equals(expect, r));
+ assertArrayEquals(expect, r);
}
} finally {
b.destroy();
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;
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
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
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;
os.write(exp[2]);
in.want(exp.length);
in.read(act);
- assertTrue(Arrays.equals(exp, act));
+ assertArrayEquals(exp, act);
}
@Test
os.write(exp);
in.want(exp.length);
in.read(act);
- assertTrue(Arrays.equals(exp, act));
+ assertArrayEquals(exp, act);
}
@Test