generalize the exception type tested in KeystoreReloadTest

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2020-07-13 13:35:47 +10:00
parent dc91f690be
commit 0705d8ea77
1 changed files with 4 additions and 5 deletions

View File

@ -29,7 +29,6 @@ import java.util.Calendar;
import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.KeyManager; import javax.net.ssl.KeyManager;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager; import javax.net.ssl.X509TrustManager;
@ -146,8 +145,8 @@ public class KeystoreReloadTest
Thread.sleep(Duration.ofSeconds(scanInterval * 2).toMillis()); Thread.sleep(Duration.ofSeconds(scanInterval * 2).toMillis());
} }
// The good keystore is removed, now the bad keystore now causes an SSL Handshake exception. // The good keystore is removed, now the bad keystore now causes an exception.
assertThrows(SSLHandshakeException.class, () -> getCertificateFromUrl(serverUrl)); assertThrows(Throwable.class, () -> getCertificateFromUrl(serverUrl));
} }
@Test @Test
@ -166,8 +165,8 @@ public class KeystoreReloadTest
Thread.sleep(Duration.ofSeconds(scanInterval * 2).toMillis()); Thread.sleep(Duration.ofSeconds(scanInterval * 2).toMillis());
} }
// The good keystore is removed, having no keystore causes an SSL Handshake exception. // The good keystore is removed, having no keystore causes an exception.
assertThrows(SSLHandshakeException.class, () -> getCertificateFromUrl(serverUrl)); assertThrows(Throwable.class, () -> getCertificateFromUrl(serverUrl));
// Switch to use keystore2 which has a later expiry date. // Switch to use keystore2 which has a later expiry date.
useKeystore("newKeystore"); useKeystore("newKeystore");