Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
LuciferYang committed Oct 23, 2023
1 parent 16c5ab2 commit 934011e
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,24 @@ public void testExceptionInInitializerErrorRandom() throws GeneralSecurityExcept
try (final CryptoRandom random = CryptoRandomFactory.getCryptoRandom(properties)) {
assertEquals(JavaCryptoRandom.class.getName(), random.getClass().getName());
}
try (final CryptoRandom random = CryptoRandomFactory.getCryptoRandom(properties)) {
assertEquals(JavaCryptoRandom.class.getName(), random.getClass().getName());
}
try (final CryptoRandom random = CryptoRandomFactory.getCryptoRandom(properties)) {
assertEquals(JavaCryptoRandom.class.getName(), random.getClass().getName());
}
}

@Test
public void testReentrancyOfExceptionInInitializerErrorRandom() throws GeneralSecurityException, IOException {
final Properties properties = new Properties();
String classes = "InvalidCipherName".concat(",")
String classes = ExceptionInInitializerErrorRandom.class.getName().concat(",")
.concat(CryptoRandomFactory.RandomProvider.JAVA.getClassName());
properties.setProperty(CryptoRandomFactory.CLASSES_KEY, classes);
try (final CryptoRandom random = CryptoRandomFactory.getCryptoRandom(properties)) {
assertEquals(JavaCryptoRandom.class.getName(), random.getClass().getName());
}
try (final CryptoRandom random = CryptoRandomFactory.getCryptoRandom(properties)) {
assertEquals(JavaCryptoRandom.class.getName(), random.getClass().getName());
}
try (final CryptoRandom random = CryptoRandomFactory.getCryptoRandom(properties)) {
assertEquals(JavaCryptoRandom.class.getName(), random.getClass().getName());
for (int i = 0; i < 3; i++) {
try (final CryptoRandom random = CryptoRandomFactory.getCryptoRandom(properties)) {
assertEquals(JavaCryptoRandom.class.getName(), random.getClass().getName());
}
}
}

Expand Down

0 comments on commit 934011e

Please sign in to comment.