From f65519cfc06693ed1775e9c00c642ab65f32ed05 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 20 Sep 2021 23:23:38 -0400 Subject: 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 --- .../policy/common/utils/security/SelfSignedKeyStoreTest.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'utils-test/src/test/java/org/onap/policy/common/utils/security/SelfSignedKeyStoreTest.java') 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) { -- cgit 1.2.3-korg