qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@apache.org
Subject [qpid-jms] branch master updated: QPIDJMS-487: allow for alternative expected exception on some JDKs
Date Wed, 29 Jan 2020 13:39:32 GMT
This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-jms.git


The following commit(s) were added to refs/heads/master by this push:
     new 65275a1  QPIDJMS-487: allow for alternative expected exception on some JDKs
65275a1 is described below

commit 65275a1c3e345843b546ed1f5015bfd9b2eea21b
Author: Robbie Gemmell <robbie@apache.org>
AuthorDate: Wed Jan 29 13:38:19 2020 +0000

    QPIDJMS-487: allow for alternative expected exception on some JDKs
---
 .../qpid/jms/transports/TransportSupportTest.java  | 27 ++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
index 90ac437..cc0a4b7 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/transports/TransportSupportTest.java
@@ -164,21 +164,40 @@ public class TransportSupportTest extends QpidJmsTestCase {
         // assertEquals(contextProtocol, context.getProtocol());
     }
 
-    @Test(expected = UnrecoverableKeyException.class)
+    @Test
     public void testCreateSslContextNoKeyStorePasswordJDK() throws Exception {
         TransportOptions options = createJksSslOptions();
         options.setKeyStorePassword(null);
-        TransportSupport.createJdkSslContext(options);
+        try {
+            TransportSupport.createJdkSslContext(options);
+            fail("Expected an exception to be thrown");
+        } catch (UnrecoverableKeyException e) {
+            // Expected
+        } catch (IllegalArgumentException iae) {
+            // Expected in certain cases
+            String message = iae.getMessage();
+            assertTrue("Unexpected message: " + message, message.contains("password can't
be null"));
+        }
     }
 
-    @Test(expected = UnrecoverableKeyException.class)
+    @Test
     public void testCreateSslContextNoKeyStorePasswordOpenSSL() throws Exception {
         assumeTrue(OpenSsl.isAvailable());
         assumeTrue(OpenSsl.supportsKeyManagerFactory());
 
         TransportOptions options = createJksSslOptions();
         options.setKeyStorePassword(null);
-        TransportSupport.createOpenSslContext(options);
+
+        try {
+            TransportSupport.createOpenSslContext(options);
+            fail("Expected an exception to be thrown");
+        } catch (UnrecoverableKeyException e) {
+            // Expected
+        } catch (IllegalArgumentException iae) {
+            // Expected in certain cases
+            String message = iae.getMessage();
+            assertTrue("Unexpected message: " + message, message.contains("password can't
be null"));
+        }
     }
 
     @Test(expected = IOException.class)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message