< prev index next >

test/hotspot/jtreg/runtime/exceptionMsgs/IncompatibleClassChangeError/IncompatibleClassChangeErrorTest.java

Print this page




 195                 !errorMsg.equals(expectedErrorMessageCompiled)) {
 196                 System.out.println("Expected: " + expectedErrorMessageCompiled + "\n" +
 197                                    "but got:  " + errorMsg);
 198                 System.out.println(exc);
 199                 throw new RuntimeException("Wrong error message of IncompatibleClassChangeError.");
 200             }
 201             if (enableChecks) {
 202                 System.out.println("Test 2 passed with message: " + errorMsg);
 203             }
 204         } catch (Throwable exc) {
 205             throw exc; // new RuntimeException("Caught unexpected exception: " + exc);
 206         }
 207 
 208         // Check we got the exception at some point.
 209         if (enableChecks && !caught_icc) {
 210             throw new RuntimeException("Expected IncompatibleClassChangeError was not thrown.");
 211         }
 212     }
 213 
 214     private static String expectedErrorMessage3 =
 215         "Class test.ICC3_B can not implement test.ICC3_A, because it is not an interface";
 216 
 217     public static void test3_implementsClass() throws Exception {
 218         try {
 219             new ICC3_B();
 220             throw new RuntimeException("Expected IncompatibleClassChangeError was not thrown.");
 221         } catch (IncompatibleClassChangeError e) {
 222             String errorMsg = e.getMessage();
 223             if (!errorMsg.equals(expectedErrorMessage3)) {
 224                 System.out.println("Expected: " + expectedErrorMessage3 + "\n" +
 225                                    "but got:  " + errorMsg);
 226                 throw new RuntimeException("Wrong error message of IncompatibleClassChangeError.");
 227             }
 228             System.out.println("Test 3 passed with message: " + errorMsg);
 229         } catch (Throwable e) {
 230             throw new RuntimeException("Caught unexpected exception: " + e);
 231         }
 232     }
 233 
 234     private static String expectedErrorMessage4 =
 235         "class test.ICC4_B has interface test.ICC4_iA as super class";




 195                 !errorMsg.equals(expectedErrorMessageCompiled)) {
 196                 System.out.println("Expected: " + expectedErrorMessageCompiled + "\n" +
 197                                    "but got:  " + errorMsg);
 198                 System.out.println(exc);
 199                 throw new RuntimeException("Wrong error message of IncompatibleClassChangeError.");
 200             }
 201             if (enableChecks) {
 202                 System.out.println("Test 2 passed with message: " + errorMsg);
 203             }
 204         } catch (Throwable exc) {
 205             throw exc; // new RuntimeException("Caught unexpected exception: " + exc);
 206         }
 207 
 208         // Check we got the exception at some point.
 209         if (enableChecks && !caught_icc) {
 210             throw new RuntimeException("Expected IncompatibleClassChangeError was not thrown.");
 211         }
 212     }
 213 
 214     private static String expectedErrorMessage3 =
 215         "class test.ICC3_B can not implement test.ICC3_A, because it is not an interface (test.ICC3_A is in unnamed module of loader 'app')";
 216 
 217     public static void test3_implementsClass() throws Exception {
 218         try {
 219             new ICC3_B();
 220             throw new RuntimeException("Expected IncompatibleClassChangeError was not thrown.");
 221         } catch (IncompatibleClassChangeError e) {
 222             String errorMsg = e.getMessage();
 223             if (!errorMsg.equals(expectedErrorMessage3)) {
 224                 System.out.println("Expected: " + expectedErrorMessage3 + "\n" +
 225                                    "but got:  " + errorMsg);
 226                 throw new RuntimeException("Wrong error message of IncompatibleClassChangeError.");
 227             }
 228             System.out.println("Test 3 passed with message: " + errorMsg);
 229         } catch (Throwable e) {
 230             throw new RuntimeException("Caught unexpected exception: " + e);
 231         }
 232     }
 233 
 234     private static String expectedErrorMessage4 =
 235         "class test.ICC4_B has interface test.ICC4_iA as super class";


< prev index next >