Polish the test code of SSLContextParametersTest

Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4b9be47b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4b9be47b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4b9be47b

Branch: refs/heads/master
Commit: 4b9be47b5ab17a6e14325bd49ebfac0791773f6d
Parents: e176435
Author: Willem Jiang <willem.ji...@gmail.com>
Authored: Tue Nov 19 17:13:12 2013 +0800
Committer: Willem Jiang <willem.ji...@gmail.com>
Committed: Tue Nov 19 17:15:27 2013 +0800

----------------------------------------------------------------------
 .../camel/util/jsse/SSLContextParametersTest.java     | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/4b9be47b/camel-core/src/test/java/org/apache/camel/util/jsse/SSLContextParametersTest.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/test/java/org/apache/camel/util/jsse/SSLContextParametersTest.java
 
b/camel-core/src/test/java/org/apache/camel/util/jsse/SSLContextParametersTest.java
index 7351ac5..11c82b2 100644
--- 
a/camel-core/src/test/java/org/apache/camel/util/jsse/SSLContextParametersTest.java
+++ 
b/camel-core/src/test/java/org/apache/camel/util/jsse/SSLContextParametersTest.java
@@ -27,6 +27,8 @@ import javax.net.ssl.SSLEngine;
 import javax.net.ssl.SSLServerSocket;
 import javax.net.ssl.SSLSocket;
 
+import junit.framework.AssertionFailedError;
+
 import org.apache.camel.CamelContext;
 
 public class SSLContextParametersTest extends AbstractJsseParametersTest {
@@ -40,6 +42,12 @@ public class SSLContextParametersTest extends 
AbstractJsseParametersTest {
                           Arrays.asList(new Pattern[0]));
         assertEquals(2, result.size());
         assertStartsWith(result, "TLS");
+        try {
+            assertStartsWith((String[]) null, "TLS");
+            fail("We chould got an exception here!");
+        } catch (AssertionFailedError ex) {
+            assertEquals("Get a wrong message", "The values should not be 
null", ex.getMessage());
+        }
     }
     
     public void testPropertyPlaceholders() throws Exception {
@@ -752,14 +760,16 @@ public class SSLContextParametersTest extends 
AbstractJsseParametersTest {
     }
     
     protected void assertStartsWith(String[] values, String prefix) {
+        assertNotNull("The values should not be null", values);
         for (String value : values) {
-            assertTrue(value.startsWith(prefix));
+            assertTrue(value + " does not start with the prefix " + prefix, 
value.startsWith(prefix));
         }
     }
     
     protected void assertStartsWith(Collection<String> values, String prefix) {
+        assertNotNull("The values should not be null", values);
         for (String value : values) {
-            assertTrue(value.startsWith(prefix));
+            assertTrue(value + " does not start with the prefix " + prefix, 
value.startsWith(prefix));
         }
     }
 }

Reply via email to