|
|
@ -44,17 +44,15 @@ |
|
|
|
package org.eclipse.jgit.util; |
|
|
|
package org.eclipse.jgit.util; |
|
|
|
|
|
|
|
|
|
|
|
import static org.eclipse.jgit.junit.JGitTestUtil.getName; |
|
|
|
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.assertEquals; |
|
|
|
import static org.junit.Assert.assertNotNull; |
|
|
|
import static org.junit.Assert.assertNotNull; |
|
|
|
import static org.junit.Assert.assertTrue; |
|
|
|
|
|
|
|
import static org.junit.Assert.fail; |
|
|
|
import static org.junit.Assert.fail; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
import java.io.ByteArrayOutputStream; |
|
|
|
import java.io.ByteArrayOutputStream; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.util.Arrays; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.eclipse.jgit.junit.TestRng; |
|
|
|
import org.eclipse.jgit.junit.TestRng; |
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.Test; |
|
|
|
|
|
|
|
|
|
|
@ -116,7 +114,7 @@ public class TemporaryBufferTest { |
|
|
|
final byte[] r = b.toByteArray(); |
|
|
|
final byte[] r = b.toByteArray(); |
|
|
|
assertNotNull(r); |
|
|
|
assertNotNull(r); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertTrue(Arrays.equals(test, r)); |
|
|
|
assertArrayEquals(test, r); |
|
|
|
} |
|
|
|
} |
|
|
|
{ |
|
|
|
{ |
|
|
|
final ByteArrayOutputStream o = new ByteArrayOutputStream(); |
|
|
|
final ByteArrayOutputStream o = new ByteArrayOutputStream(); |
|
|
@ -124,7 +122,7 @@ public class TemporaryBufferTest { |
|
|
|
o.close(); |
|
|
|
o.close(); |
|
|
|
final byte[] r = o.toByteArray(); |
|
|
|
final byte[] r = o.toByteArray(); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertTrue(Arrays.equals(test, r)); |
|
|
|
assertArrayEquals(test, r); |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
b.destroy(); |
|
|
|
b.destroy(); |
|
|
@ -147,7 +145,7 @@ public class TemporaryBufferTest { |
|
|
|
final byte[] r = b.toByteArray(); |
|
|
|
final byte[] r = b.toByteArray(); |
|
|
|
assertNotNull(r); |
|
|
|
assertNotNull(r); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertTrue(Arrays.equals(test, r)); |
|
|
|
assertArrayEquals(test, r); |
|
|
|
} |
|
|
|
} |
|
|
|
{ |
|
|
|
{ |
|
|
|
final ByteArrayOutputStream o = new ByteArrayOutputStream(); |
|
|
|
final ByteArrayOutputStream o = new ByteArrayOutputStream(); |
|
|
@ -155,7 +153,7 @@ public class TemporaryBufferTest { |
|
|
|
o.close(); |
|
|
|
o.close(); |
|
|
|
final byte[] r = o.toByteArray(); |
|
|
|
final byte[] r = o.toByteArray(); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertTrue(Arrays.equals(test, r)); |
|
|
|
assertArrayEquals(test, r); |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
b.destroy(); |
|
|
|
b.destroy(); |
|
|
@ -176,7 +174,7 @@ public class TemporaryBufferTest { |
|
|
|
final byte[] r = b.toByteArray(); |
|
|
|
final byte[] r = b.toByteArray(); |
|
|
|
assertNotNull(r); |
|
|
|
assertNotNull(r); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertTrue(Arrays.equals(test, r)); |
|
|
|
assertArrayEquals(test, r); |
|
|
|
} |
|
|
|
} |
|
|
|
{ |
|
|
|
{ |
|
|
|
final ByteArrayOutputStream o = new ByteArrayOutputStream(); |
|
|
|
final ByteArrayOutputStream o = new ByteArrayOutputStream(); |
|
|
@ -184,7 +182,7 @@ public class TemporaryBufferTest { |
|
|
|
o.close(); |
|
|
|
o.close(); |
|
|
|
final byte[] r = o.toByteArray(); |
|
|
|
final byte[] r = o.toByteArray(); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertTrue(Arrays.equals(test, r)); |
|
|
|
assertArrayEquals(test, r); |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
b.destroy(); |
|
|
|
b.destroy(); |
|
|
@ -206,7 +204,7 @@ public class TemporaryBufferTest { |
|
|
|
final byte[] r = b.toByteArray(); |
|
|
|
final byte[] r = b.toByteArray(); |
|
|
|
assertNotNull(r); |
|
|
|
assertNotNull(r); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertTrue(Arrays.equals(test, r)); |
|
|
|
assertArrayEquals(test, r); |
|
|
|
} |
|
|
|
} |
|
|
|
{ |
|
|
|
{ |
|
|
|
final ByteArrayOutputStream o = new ByteArrayOutputStream(); |
|
|
|
final ByteArrayOutputStream o = new ByteArrayOutputStream(); |
|
|
@ -214,7 +212,7 @@ public class TemporaryBufferTest { |
|
|
|
o.close(); |
|
|
|
o.close(); |
|
|
|
final byte[] r = o.toByteArray(); |
|
|
|
final byte[] r = o.toByteArray(); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertTrue(Arrays.equals(test, r)); |
|
|
|
assertArrayEquals(test, r); |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
b.destroy(); |
|
|
|
b.destroy(); |
|
|
@ -234,7 +232,7 @@ public class TemporaryBufferTest { |
|
|
|
final byte[] r = b.toByteArray(); |
|
|
|
final byte[] r = b.toByteArray(); |
|
|
|
assertNotNull(r); |
|
|
|
assertNotNull(r); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertTrue(Arrays.equals(test, r)); |
|
|
|
assertArrayEquals(test, r); |
|
|
|
} |
|
|
|
} |
|
|
|
{ |
|
|
|
{ |
|
|
|
final ByteArrayOutputStream o = new ByteArrayOutputStream(); |
|
|
|
final ByteArrayOutputStream o = new ByteArrayOutputStream(); |
|
|
@ -242,7 +240,7 @@ public class TemporaryBufferTest { |
|
|
|
o.close(); |
|
|
|
o.close(); |
|
|
|
final byte[] r = o.toByteArray(); |
|
|
|
final byte[] r = o.toByteArray(); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertTrue(Arrays.equals(test, r)); |
|
|
|
assertArrayEquals(test, r); |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
b.destroy(); |
|
|
|
b.destroy(); |
|
|
@ -260,7 +258,7 @@ public class TemporaryBufferTest { |
|
|
|
InputStream in = b.openInputStream(); |
|
|
|
InputStream in = b.openInputStream(); |
|
|
|
byte[] act = new byte[cnt]; |
|
|
|
byte[] act = new byte[cnt]; |
|
|
|
IO.readFully(in, act, 0, cnt); |
|
|
|
IO.readFully(in, act, 0, cnt); |
|
|
|
assertTrue(Arrays.equals(test, act)); |
|
|
|
assertArrayEquals(test, act); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -277,7 +275,7 @@ public class TemporaryBufferTest { |
|
|
|
final byte[] r = b.toByteArray(); |
|
|
|
final byte[] r = b.toByteArray(); |
|
|
|
assertNotNull(r); |
|
|
|
assertNotNull(r); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertTrue(Arrays.equals(test, r)); |
|
|
|
assertArrayEquals(test, r); |
|
|
|
} |
|
|
|
} |
|
|
|
{ |
|
|
|
{ |
|
|
|
final ByteArrayOutputStream o = new ByteArrayOutputStream(); |
|
|
|
final ByteArrayOutputStream o = new ByteArrayOutputStream(); |
|
|
@ -285,7 +283,7 @@ public class TemporaryBufferTest { |
|
|
|
o.close(); |
|
|
|
o.close(); |
|
|
|
final byte[] r = o.toByteArray(); |
|
|
|
final byte[] r = o.toByteArray(); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertTrue(Arrays.equals(test, r)); |
|
|
|
assertArrayEquals(test, r); |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
b.destroy(); |
|
|
|
b.destroy(); |
|
|
@ -306,7 +304,7 @@ public class TemporaryBufferTest { |
|
|
|
final byte[] r = b.toByteArray(); |
|
|
|
final byte[] r = b.toByteArray(); |
|
|
|
assertNotNull(r); |
|
|
|
assertNotNull(r); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertTrue(Arrays.equals(test, r)); |
|
|
|
assertArrayEquals(test, r); |
|
|
|
} |
|
|
|
} |
|
|
|
{ |
|
|
|
{ |
|
|
|
final ByteArrayOutputStream o = new ByteArrayOutputStream(); |
|
|
|
final ByteArrayOutputStream o = new ByteArrayOutputStream(); |
|
|
@ -314,7 +312,7 @@ public class TemporaryBufferTest { |
|
|
|
o.close(); |
|
|
|
o.close(); |
|
|
|
final byte[] r = o.toByteArray(); |
|
|
|
final byte[] r = o.toByteArray(); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertTrue(Arrays.equals(test, r)); |
|
|
|
assertArrayEquals(test, r); |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
b.destroy(); |
|
|
|
b.destroy(); |
|
|
@ -338,7 +336,7 @@ public class TemporaryBufferTest { |
|
|
|
final byte[] r = b.toByteArray(); |
|
|
|
final byte[] r = b.toByteArray(); |
|
|
|
assertNotNull(r); |
|
|
|
assertNotNull(r); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertTrue(Arrays.equals(test, r)); |
|
|
|
assertArrayEquals(test, r); |
|
|
|
} |
|
|
|
} |
|
|
|
{ |
|
|
|
{ |
|
|
|
final ByteArrayOutputStream o = new ByteArrayOutputStream(); |
|
|
|
final ByteArrayOutputStream o = new ByteArrayOutputStream(); |
|
|
@ -346,7 +344,7 @@ public class TemporaryBufferTest { |
|
|
|
o.close(); |
|
|
|
o.close(); |
|
|
|
final byte[] r = o.toByteArray(); |
|
|
|
final byte[] r = o.toByteArray(); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertEquals(test.length, r.length); |
|
|
|
assertTrue(Arrays.equals(test, r)); |
|
|
|
assertArrayEquals(test, r); |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
b.destroy(); |
|
|
|
b.destroy(); |
|
|
@ -396,7 +394,7 @@ public class TemporaryBufferTest { |
|
|
|
final byte[] r = b.toByteArray(); |
|
|
|
final byte[] r = b.toByteArray(); |
|
|
|
assertNotNull(r); |
|
|
|
assertNotNull(r); |
|
|
|
assertEquals(expect.length, r.length); |
|
|
|
assertEquals(expect.length, r.length); |
|
|
|
assertTrue(Arrays.equals(expect, r)); |
|
|
|
assertArrayEquals(expect, r); |
|
|
|
} |
|
|
|
} |
|
|
|
{ |
|
|
|
{ |
|
|
|
final ByteArrayOutputStream o = new ByteArrayOutputStream(); |
|
|
|
final ByteArrayOutputStream o = new ByteArrayOutputStream(); |
|
|
@ -404,7 +402,7 @@ public class TemporaryBufferTest { |
|
|
|
o.close(); |
|
|
|
o.close(); |
|
|
|
final byte[] r = o.toByteArray(); |
|
|
|
final byte[] r = o.toByteArray(); |
|
|
|
assertEquals(expect.length, r.length); |
|
|
|
assertEquals(expect.length, r.length); |
|
|
|
assertTrue(Arrays.equals(expect, r)); |
|
|
|
assertArrayEquals(expect, r); |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
b.destroy(); |
|
|
|
b.destroy(); |
|
|
|