mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-21 07:09:56 +01:00
Replaced assertTrue(Arrays.equals()) with assertArrayEquals().
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
package net.sf.briar.transport;
|
||||
|
||||
import static net.sf.briar.api.transport.TransportConstants.IV_LENGTH;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKey;
|
||||
@@ -107,6 +107,6 @@ public class ConnectionDecrypterImplTest extends TestCase {
|
||||
out.write(decrypted1);
|
||||
out.write(decryptedMac1);
|
||||
byte[] actual = out.toByteArray();
|
||||
assertTrue(Arrays.equals(expected, actual));
|
||||
assertArrayEquals(expected, actual);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package net.sf.briar.transport;
|
||||
|
||||
import static net.sf.briar.api.transport.TransportConstants.IV_LENGTH;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKey;
|
||||
@@ -91,7 +91,7 @@ public class ConnectionEncrypterImplTest extends TestCase {
|
||||
e.writeMac(plaintextMac);
|
||||
byte[] actual = out.toByteArray();
|
||||
// Check that the actual ciphertext matches the expected ciphertext
|
||||
assertTrue(Arrays.equals(expected, actual));
|
||||
assertArrayEquals(expected, actual);
|
||||
assertEquals(Long.MAX_VALUE - actual.length, e.getRemainingCapacity());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package net.sf.briar.transport;
|
||||
|
||||
import static net.sf.briar.api.transport.TransportConstants.MAX_FRAME_LENGTH;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.sf.briar.TestUtils;
|
||||
import net.sf.briar.api.FormatException;
|
||||
@@ -142,10 +142,10 @@ public class ConnectionReaderImplTest extends TransportTest {
|
||||
ConnectionReader r = new ConnectionReaderImpl(d, mac, macKey);
|
||||
byte[] read = new byte[123];
|
||||
TestUtils.readFully(r.getInputStream(), read);
|
||||
assertTrue(Arrays.equals(new byte[123], read));
|
||||
assertArrayEquals(new byte[123], read);
|
||||
byte[] read1 = new byte[1234];
|
||||
TestUtils.readFully(r.getInputStream(), read1);
|
||||
assertTrue(Arrays.equals(new byte[1234], read1));
|
||||
assertArrayEquals(new byte[1234], read1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package net.sf.briar.transport;
|
||||
|
||||
import static net.sf.briar.api.transport.TransportConstants.MAX_FRAME_LENGTH;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.sf.briar.api.transport.ConnectionWriter;
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ConnectionWriterImplTest extends TransportTest {
|
||||
ConnectionWriter w = new ConnectionWriterImpl(e, mac, macKey);
|
||||
w.getOutputStream().write(0);
|
||||
w.getOutputStream().flush();
|
||||
assertTrue(Arrays.equals(frame, out.toByteArray()));
|
||||
assertArrayEquals(frame, out.toByteArray());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -100,6 +100,6 @@ public class ConnectionWriterImplTest extends TransportTest {
|
||||
w.getOutputStream().write(new byte[1234]);
|
||||
w.getOutputStream().flush();
|
||||
byte[] actual = out.toByteArray();
|
||||
assertTrue(Arrays.equals(expected, actual));
|
||||
assertArrayEquals(expected, actual);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package net.sf.briar.transport;
|
||||
|
||||
import static net.sf.briar.api.transport.TransportConstants.IV_LENGTH;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
@@ -86,7 +86,7 @@ public class FrameReadWriteTest extends TestCase {
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
|
||||
byte[] recoveredIv = new byte[IV_LENGTH];
|
||||
assertEquals(IV_LENGTH, in.read(recoveredIv));
|
||||
assertTrue(Arrays.equals(encryptedIv, recoveredIv));
|
||||
assertArrayEquals(encryptedIv, recoveredIv);
|
||||
// Read the frames back
|
||||
ConnectionDecrypter decrypter = new ConnectionDecrypterImpl(in,
|
||||
recoveredIv, ivCipher, frameCipher, ivKey, frameKey);
|
||||
@@ -101,7 +101,7 @@ public class FrameReadWriteTest extends TestCase {
|
||||
offset += read;
|
||||
}
|
||||
assertEquals(recovered.length, offset);
|
||||
assertTrue(Arrays.equals(frame, recovered));
|
||||
assertArrayEquals(frame, recovered);
|
||||
byte[] recovered1 = new byte[frame1.length];
|
||||
offset = 0;
|
||||
while(offset < recovered1.length) {
|
||||
@@ -110,6 +110,6 @@ public class FrameReadWriteTest extends TestCase {
|
||||
offset += read;
|
||||
}
|
||||
assertEquals(recovered1.length, offset);
|
||||
assertTrue(Arrays.equals(frame1, recovered1));
|
||||
assertArrayEquals(frame1, recovered1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user