Expose AssertionErrors as is

Closes gh-9760
pull/9771/head
Stephane Nicoll 7 years ago
parent 51c2b049c2
commit e844c92465

@ -186,7 +186,7 @@ class AbstractContextLoader<T extends ConfigurableApplicationContext, L extends
T ctx = handler.load();
contextHandler.handle(ctx);
}
catch (RuntimeException ex) {
catch (RuntimeException | AssertionError ex) {
throw ex;
}
catch (Throwable ex) {

@ -194,6 +194,18 @@ public class StandardContextLoaderTests {
});
}
@Test
public void assertionErrorsAreAvailableAsIs() {
try {
this.contextLoader.load(context -> {
fail("This is expected");
});
}
catch (AssertionError ex) {
assertThat(ex.getMessage()).isEqualTo("This is expected");
}
}
@Configuration
static class ConfigA {

Loading…
Cancel
Save