aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Chang <vichang@google.com>2024-02-20 21:36:53 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-02-20 21:36:53 +0000
commitef4f666ee3ccb51b737fd3ad943f420fab5a85fd (patch)
tree83235c800f960e0a9fc42f0612504d14b01219f9
parentfbffc104c693e51a7664d6b96b5e8d34570b66b0 (diff)
parentbdd151e7d51eb8d3f3b4dd5261224c6bf7b0aff1 (diff)
downloadlibcore-ef4f666ee3ccb51b737fd3ad943f420fab5a85fd.tar.gz
Merge "Add API tests for java/javax.security.spec" into main
-rw-r--r--JavaLibrary.bp1
-rw-r--r--luni/src/test/java/tests/javax/crypto/spec/ChaCha20ParameterSpecTest.java (renamed from luni/src/test/java/libcore/javax/crypto/spec/ChaCha20ParameterSpecTest.java)2
-rw-r--r--luni/src/test/java/tests/security/spec/PKCS8EncodedKeySpecTest.java8
-rw-r--r--luni/src/test/java/tests/security/spec/X509EncodedKeySpecTest.java7
-rwxr-xr-xtools/checkstyle/libcore-checkstyle.sh1
5 files changed, 17 insertions, 2 deletions
diff --git a/JavaLibrary.bp b/JavaLibrary.bp
index 63d8fa85bd0..015f3c844f4 100644
--- a/JavaLibrary.bp
+++ b/JavaLibrary.bp
@@ -832,7 +832,6 @@ java_test {
],
exclude_srcs: [
"luni/src/test/java/libcore/javax/crypto/CipherTest.java",
- "luni/src/test/java/libcore/javax/crypto/spec/ChaCha20ParameterSpecTest.java",
],
srcs: [
"harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/*.java",
diff --git a/luni/src/test/java/libcore/javax/crypto/spec/ChaCha20ParameterSpecTest.java b/luni/src/test/java/tests/javax/crypto/spec/ChaCha20ParameterSpecTest.java
index 185a7229b6d..062fc229864 100644
--- a/luni/src/test/java/libcore/javax/crypto/spec/ChaCha20ParameterSpecTest.java
+++ b/luni/src/test/java/tests/javax/crypto/spec/ChaCha20ParameterSpecTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package libcore.javax.crypto.spec;
+package tests.javax.crypto.spec;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
diff --git a/luni/src/test/java/tests/security/spec/PKCS8EncodedKeySpecTest.java b/luni/src/test/java/tests/security/spec/PKCS8EncodedKeySpecTest.java
index 31e06151646..c05e56f79be 100644
--- a/luni/src/test/java/tests/security/spec/PKCS8EncodedKeySpecTest.java
+++ b/luni/src/test/java/tests/security/spec/PKCS8EncodedKeySpecTest.java
@@ -133,4 +133,12 @@ public class PKCS8EncodedKeySpecTest extends TestCase {
assertTrue(Arrays.equals(encodedKey, ek1));
}
+ public final void testGetAlgorithm() {
+ byte[] encodedKey = new byte[] {(byte)1,(byte)2,(byte)3,(byte)4};
+ String algorithm = "MyAlgorithm";
+
+ PKCS8EncodedKeySpec meks = new PKCS8EncodedKeySpec(encodedKey, algorithm);
+ assertEquals(algorithm, meks.getAlgorithm());
+ }
+
}
diff --git a/luni/src/test/java/tests/security/spec/X509EncodedKeySpecTest.java b/luni/src/test/java/tests/security/spec/X509EncodedKeySpecTest.java
index 14f650c27fc..eba8f8f54ae 100644
--- a/luni/src/test/java/tests/security/spec/X509EncodedKeySpecTest.java
+++ b/luni/src/test/java/tests/security/spec/X509EncodedKeySpecTest.java
@@ -134,4 +134,11 @@ public class X509EncodedKeySpecTest extends TestCase {
assertTrue(Arrays.equals(encodedKey, ek1));
}
+ public void testGetAlgorithm() {
+ byte[] encodedKey = new byte[] {(byte)1,(byte)2,(byte)3,(byte)4};
+ String algorithm = "MyAlgorithm";
+ X509EncodedKeySpec meks = new X509EncodedKeySpec(encodedKey, algorithm);
+ assertEquals(algorithm, meks.getAlgorithm());
+ }
+
}
diff --git a/tools/checkstyle/libcore-checkstyle.sh b/tools/checkstyle/libcore-checkstyle.sh
index f16056e517f..580c7be82f9 100755
--- a/tools/checkstyle/libcore-checkstyle.sh
+++ b/tools/checkstyle/libcore-checkstyle.sh
@@ -54,6 +54,7 @@ declare -A PATH_TO_CONFIG=(
[luni/src/test/java/tests/java/nio]=tools/checkstyle/aosp-copyright.xml
[luni/src/test/java/tests/java/security]=tools/checkstyle/asf-copyright.xml
[luni/src/test/java/tests/java/sql]=tools/checkstyle/aosp-copyright.xml
+ [luni/src/test/java/tests/javax/crypto]=tools/checkstyle/aosp-copyright.xml
[luni/src/test/java/tests/org/w3c]=tools/checkstyle/w3c-copyright.xml
[luni/src/test/java/tests/security]=tools/checkstyle/not-gpl.xml
[luni/src/test/java/tests/support]=tools/checkstyle/aosp-copyright.xml