diff options
author | Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> | 2024-02-27 16:05:21 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-02-27 16:05:21 +0000 |
commit | e1c685f2fe63f3cb1d759f3b378299b9a0b39426 (patch) | |
tree | 43834abb7f270123faa67591876664634ebad679 | |
parent | 790a6497c1f0002ae26b41f8e7de268aa1f6188c (diff) | |
parent | 997a8eeb0ae4f0bf8decb7938ba1291f6b75191a (diff) | |
download | libcore-e1c685f2fe63f3cb1d759f3b378299b9a0b39426.tar.gz |
Merge changes Id44d3533,I5077a770 into main
* changes:
Add test for java.util.LinkedHashSet.newLinkedHashSet(int)
Add test for SecureRandom.getParameters()
-rw-r--r-- | luni/src/test/java/libcore/java/security/SecureRandomSpiTest.java | 9 | ||||
-rw-r--r-- | luni/src/test/java/libcore/java/util/LinkedHashSetTest.java | 37 |
2 files changed, 46 insertions, 0 deletions
diff --git a/luni/src/test/java/libcore/java/security/SecureRandomSpiTest.java b/luni/src/test/java/libcore/java/security/SecureRandomSpiTest.java index 60df82c226a..1dc0952a12d 100644 --- a/luni/src/test/java/libcore/java/security/SecureRandomSpiTest.java +++ b/luni/src/test/java/libcore/java/security/SecureRandomSpiTest.java @@ -116,6 +116,15 @@ public class SecureRandomSpiTest { } @Test + public void testGetParameters() throws NoSuchAlgorithmException { + SecureRandom secureRandom = SecureRandom.getInstance(MySecureRandomProvider.ALGORITHM, + MY_PARAMS); + // It's testing the default implementation of engineGetParameters() + // in java.security.SecureRandom, and MY_PARAMS is not used. + Assert.assertNull(secureRandom.getParameters()); + } + + @Test public void testConstructor() { SecureRandomParameters myParams = new SecureRandomParameters() {}; MySecureRandomSpi mySpi = new MySecureRandomSpi(myParams); diff --git a/luni/src/test/java/libcore/java/util/LinkedHashSetTest.java b/luni/src/test/java/libcore/java/util/LinkedHashSetTest.java new file mode 100644 index 00000000000..10df4e07a79 --- /dev/null +++ b/luni/src/test/java/libcore/java/util/LinkedHashSetTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package libcore.java.util; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +import java.util.LinkedHashSet; + +@RunWith(JUnit4.class) +public class LinkedHashSetTest { + + @Test + public void testNewLinkedHashSet() { + LinkedHashSet<String> h1 = LinkedHashSet.newLinkedHashSet(5); + assertTrue(h1.isEmpty()); + assertEquals(LinkedHashSet.class, h1.getClass()); + } +} |