Expose AssertionErrors as is
Closes gh-9760
This commit is contained in:
@@ -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 {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user