test/jdk/java/net/httpclient/InvalidSSLContextTest.java
branchhttp-client-branch
changeset 56744 efbae6e5b3cd
parent 56682 9822bbe48b9b
child 56771 73a6534bce94
equal deleted inserted replaced
56736:705824c1e596 56744:efbae6e5b3cd
   132 
   132 
   133     static void assertExceptionOrCause(Class<? extends Throwable> clazz, Throwable t) {
   133     static void assertExceptionOrCause(Class<? extends Throwable> clazz, Throwable t) {
   134         if (t == null) {
   134         if (t == null) {
   135             Assert.fail("Expected " + clazz + ", caught nothing");
   135             Assert.fail("Expected " + clazz + ", caught nothing");
   136         }
   136         }
       
   137         final Throwable original = t;
   137         do {
   138         do {
   138             if (clazz.isInstance(t)) {
   139             if (clazz.isInstance(t)) {
   139                 return; // found
   140                 return; // found
   140             }
   141             }
   141         } while ((t = t.getCause()) != null);
   142         } while ((t = t.getCause()) != null);
   142         t.printStackTrace(System.out);
   143         original.printStackTrace(System.out);
   143         Assert.fail("Expected " + clazz + "in " + t);
   144         Assert.fail("Expected " + clazz + "in " + original);
   144     }
   145     }
   145 
   146 
   146     @BeforeTest
   147     @BeforeTest
   147     public void setup() throws Exception {
   148     public void setup() throws Exception {
   148         sslContext = new SimpleSSLContext().get();
   149         sslContext = new SimpleSSLContext().get();