@@ -356,10 +356,14 @@ 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
+ AssertionError ae = new AssertionError ("Multiple errors: " + err .size ());
360
+ ae .initCause (new CompositeException (err ));
361
+ throw ae ;
360
362
} else
361
363
if (!clazz .isInstance (err .get (0 ))) {
362
- throw new AssertionError ("Exceptions differ; expected: " + clazz + ", actual: " + err .get (0 ), err .get (0 ));
364
+ AssertionError ae = new AssertionError ("Exceptions differ; expected: " + clazz + ", actual: " + err .get (0 ));
365
+ ae .initCause (err .get (0 ));
366
+ throw ae ;
363
367
}
364
368
}
365
369
@@ -378,10 +382,14 @@ public void assertError(Throwable throwable) {
378
382
throw new AssertionError ("No errors" );
379
383
} else
380
384
if (err .size () > 1 ) {
381
- throw new AssertionError ("Multiple errors: " + err .size (), new CompositeException (err ));
385
+ AssertionError ae = new AssertionError ("Multiple errors: " + err .size ());
386
+ ae .initCause (new CompositeException (err ));
387
+ throw ae ;
382
388
} else
383
389
if (!throwable .equals (err .get (0 ))) {
384
- throw new AssertionError ("Exceptions differ; expected: " + throwable + ", actual: " + err .get (0 ), err .get (0 ));
390
+ AssertionError ae = new AssertionError ("Exceptions differ; expected: " + throwable + ", actual: " + err .get (0 ));
391
+ ae .initCause (err .get (0 ));
392
+ throw ae ;
385
393
}
386
394
}
387
395
@@ -400,9 +408,13 @@ public void assertNoTerminalEvent() {
400
408
throw new AssertionError ("Found " + err .size () + " errors and " + s + " completion events instead of none" );
401
409
} else
402
410
if (err .size () == 1 ) {
403
- throw new AssertionError ("Found " + err .size () + " errors and " + s + " completion events instead of none" , err .get (0 ));
411
+ AssertionError ae = new AssertionError ("Found " + err .size () + " errors and " + s + " completion events instead of none" );
412
+ ae .initCause (err .get (0 ));
413
+ throw ae ;
404
414
} else {
405
- throw new AssertionError ("Found " + err .size () + " errors and " + s + " completion events instead of none" , new CompositeException (err ));
415
+ AssertionError ae = new AssertionError ("Found " + err .size () + " errors and " + s + " completion events instead of none" );
416
+ ae .initCause (new CompositeException (err ));
417
+ throw ae ;
406
418
}
407
419
}
408
420
}
0 commit comments