aboutsummaryrefslogtreecommitdiffstats
path: root/utils-test/src/test/java/org/onap/policy/common/utils/security/SelfSignedKeyStoreTest.java
diff options
context:
space:
mode:
authorJim Hahn <jrh3.lf@gmail.com>2021-09-20 23:23:38 -0400
committerLiam Fallon <liam.fallon@est.tech>2021-09-22 08:03:44 +0000
commitf65519cfc06693ed1775e9c00c642ab65f32ed05 (patch)
tree0da63e8584e1fcf9d6c5b36b7b83c1eba8f7bd96 /utils-test/src/test/java/org/onap/policy/common/utils/security/SelfSignedKeyStoreTest.java
parent340dce2b7c9d79c994e4be7f45428820b9b8c50b (diff)
Don't use keytool in test code
Modified code to generate a self-signed certificate file programmatically instead of using keytool. Issue-ID: POLICY-3587 Change-Id: I53b6ffe65f33e5710eba633973e5d23b148f049f Signed-off-by: Jim Hahn <jrh3.lf@gmail.com>
Diffstat (limited to 'utils-test/src/test/java/org/onap/policy/common/utils/security/SelfSignedKeyStoreTest.java')
-rw-r--r--utils-test/src/test/java/org/onap/policy/common/utils/security/SelfSignedKeyStoreTest.java9
1 files changed, 4 insertions, 5 deletions
diff --git a/utils-test/src/test/java/org/onap/policy/common/utils/security/SelfSignedKeyStoreTest.java b/utils-test/src/test/java/org/onap/policy/common/utils/security/SelfSignedKeyStoreTest.java
index 62565bde..27bceacf 100644
--- a/utils-test/src/test/java/org/onap/policy/common/utils/security/SelfSignedKeyStoreTest.java
+++ b/utils-test/src/test/java/org/onap/policy/common/utils/security/SelfSignedKeyStoreTest.java
@@ -118,12 +118,12 @@ public class SelfSignedKeyStoreTest {
}
/**
- * Tests the constructor, when keytool fails.
+ * Tests the constructor, when write fails.
*/
@Test
- public void testSelfSignedKeyStoreStringKeytoolFailure() throws Exception {
+ public void testSelfSignedKeyStoreStringWriteFailure() throws Exception {
assertThatThrownBy(() -> new SelfSignedKeyStore("target/unknown/path/to/keystore"))
- .isInstanceOf(IOException.class).hasMessageContaining("keytool exited with");
+ .isInstanceOf(IOException.class);
}
@Test
@@ -140,8 +140,7 @@ public class SelfSignedKeyStoreTest {
assertThat(defaultKeystore).exists();
// try again using the original relative path - should fail, as it's now deeper
- assertThatThrownBy(() -> new SelfSignedKeyStore(relpath)).isInstanceOf(IOException.class)
- .hasMessageContaining("keytool exited with");
+ assertThatThrownBy(() -> new SelfSignedKeyStore(relpath)).isInstanceOf(IOException.class);
}
private static void delete(File file) {