You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sm...@apache.org on 2006/04/20 10:10:17 UTC
svn commit: r395529 -
/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/tests/api/javax/crypto/CipherTest.java
Author: smishura
Date: Thu Apr 20 01:10:15 2006
New Revision: 395529
URL: http://svn.apache.org/viewcvs?rev=395529&view=rev
Log:
Substituting bytesArraysAreEqual with Arrays.equals
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/tests/api/javax/crypto/CipherTest.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/tests/api/javax/crypto/CipherTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/tests/api/javax/crypto/CipherTest.java?rev=395529&r1=395528&r2=395529&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/tests/api/javax/crypto/CipherTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/tests/api/javax/crypto/CipherTest.java Thu Apr 20 01:10:15 2006
@@ -26,6 +26,7 @@
import java.security.SecureRandom;
import java.security.Security;
import java.security.spec.AlgorithmParameterSpec;
+import java.util.Arrays;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
@@ -242,7 +243,7 @@
byte[] cipherIV = cipher.getIV();
- assertTrue("IVs differ", bytesArraysAreEqual(cipherIV, iv));
+ assertTrue("IVs differ", Arrays.equals(cipherIV, iv));
}
/**
@@ -293,7 +294,7 @@
try {
byte[] cipherParmsEnc = cipher.getParameters().getEncoded("ASN.1");
- assertTrue("Parameters differ", bytesArraysAreEqual(apEncoding,
+ assertTrue("Parameters differ", Arrays.equals(apEncoding,
cipherParmsEnc));
} catch (IOException e) {
fail("Parameter encoding problem");
@@ -411,7 +412,7 @@
byte[] cipherIV = cipher.getIV();
- assertTrue("IVs differ", bytesArraysAreEqual(cipherIV, iv));
+ assertTrue("IVs differ", Arrays.equals(cipherIV, iv));
}
/**
@@ -457,7 +458,7 @@
byte[] cipherIV = cipher.getIV();
- assertTrue("IVs differ", bytesArraysAreEqual(cipherIV, iv));
+ assertTrue("IVs differ", Arrays.equals(cipherIV, iv));
}
/**
@@ -504,9 +505,8 @@
byte[] plaintextBytes = loadBytes("hyts_" + "des-ede3-cbc.test"
+ index + ".plaintext");
- if (bytesArraysAreEqual(plaintextBytes, decipheredCipherText) == false) {
- fail("Operation produced incorrect results");
- }
+ assertTrue("Operation produced incorrect results", Arrays.equals(
+ plaintextBytes, decipheredCipherText));
}// end for
}
@@ -552,9 +552,8 @@
byte[] cipherText = loadBytes("hyts_" + "des-ede3-cbc.test"
+ index + ".cipherText");
- if (!bytesArraysAreEqual(encryptedPlaintext, cipherText)) {
- fail("Operation produced incorrect results");
- }
+ assertTrue("Operation produced incorrect results", Arrays.equals(
+ encryptedPlaintext, cipherText));
}// end for
}
@@ -583,17 +582,4 @@
assertNotNull("Failed to load resource: " + name, is);
return is;
}
-
- private boolean bytesArraysAreEqual(byte[] arr1, byte[] arr2) {
- if (arr1.length != arr2.length) {
- return false;
- }
-
- for (int i = 0; i < arr1.length; i++) {
- if (arr1[i] != arr2[i]) {
- return false;
- }
- }
- return true;
- }
-}
\ No newline at end of file
+}