@@ -356,10 +356,12 @@ public void assertError(Class<? extends Throwable> clazz) {
356
356
throw new AssertionError ("No errors" );
357
357
} else
358
358
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 ));
360
361
} else
361
362
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 ));
363
365
}
364
366
}
365
367
@@ -378,10 +380,12 @@ public void assertError(Throwable throwable) {
378
380
throw new AssertionError ("No errors" );
379
381
} else
380
382
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 ));
382
385
} else
383
386
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 ));
385
389
}
386
390
}
387
391
@@ -400,9 +404,11 @@ public void assertNoTerminalEvent() {
400
404
throw new AssertionError ("Found " + err .size () + " errors and " + s + " completion events instead of none" );
401
405
} else
402
406
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 ));
404
409
} 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 ));
406
412
}
407
413
}
408
414
}
0 commit comments