@@ -356,10 +356,12 @@ public void assertError(Class<? extends Throwable> clazz) {
356356 throw new AssertionError ("No errors" );
357357 } else
358358 if (err .size () > 1 ) {
359- throw new AssertionError ("Multiple errors: " + err .size (), new CompositeException (err ));
359+ // can't use AssertionError because (message, cause) doesn't exist until Java 7
360+ throw new RuntimeException ("Multiple errors: " + err .size (), new CompositeException (err ));
360361 } else
361362 if (!clazz .isInstance (err .get (0 ))) {
362- throw new AssertionError ("Exceptions differ; expected: " + clazz + ", actual: " + err .get (0 ), err .get (0 ));
363+ // can't use AssertionError because (message, cause) doesn't exist until Java 7
364+ throw new RuntimeException ("Exceptions differ; expected: " + clazz + ", actual: " + err .get (0 ), err .get (0 ));
363365 }
364366 }
365367
@@ -378,10 +380,12 @@ public void assertError(Throwable throwable) {
378380 throw new AssertionError ("No errors" );
379381 } else
380382 if (err .size () > 1 ) {
381- throw new AssertionError ("Multiple errors: " + err .size (), new CompositeException (err ));
383+ // can't use AssertionError because (message, cause) doesn't exist until Java 7
384+ throw new RuntimeException ("Multiple errors: " + err .size (), new CompositeException (err ));
382385 } else
383386 if (!throwable .equals (err .get (0 ))) {
384- throw new AssertionError ("Exceptions differ; expected: " + throwable + ", actual: " + err .get (0 ), err .get (0 ));
387+ // can't use AssertionError because (message, cause) doesn't exist until Java 7
388+ throw new RuntimeException ("Exceptions differ; expected: " + throwable + ", actual: " + err .get (0 ), err .get (0 ));
385389 }
386390 }
387391
@@ -400,9 +404,11 @@ public void assertNoTerminalEvent() {
400404 throw new AssertionError ("Found " + err .size () + " errors and " + s + " completion events instead of none" );
401405 } else
402406 if (err .size () == 1 ) {
403- throw new AssertionError ("Found " + err .size () + " errors and " + s + " completion events instead of none" , err .get (0 ));
407+ // can't use AssertionError because (message, cause) doesn't exist until Java 7
408+ throw new RuntimeException ("Found " + err .size () + " errors and " + s + " completion events instead of none" , err .get (0 ));
404409 } else {
405- throw new AssertionError ("Found " + err .size () + " errors and " + s + " completion events instead of none" , new CompositeException (err ));
410+ // can't use AssertionError because (message, cause) doesn't exist until Java 7
411+ throw new RuntimeException ("Found " + err .size () + " errors and " + s + " completion events instead of none" , new CompositeException (err ));
406412 }
407413 }
408414 }
0 commit comments