Commit e844c924 authored by Stephane Nicoll's avatar Stephane Nicoll

Expose AssertionErrors as is

Closes gh-9760
parent 51c2b049
...@@ -186,7 +186,7 @@ class AbstractContextLoader<T extends ConfigurableApplicationContext, L extends ...@@ -186,7 +186,7 @@ class AbstractContextLoader<T extends ConfigurableApplicationContext, L extends
T ctx = handler.load(); T ctx = handler.load();
contextHandler.handle(ctx); contextHandler.handle(ctx);
} }
catch (RuntimeException ex) { catch (RuntimeException | AssertionError ex) {
throw ex; throw ex;
} }
catch (Throwable ex) { catch (Throwable ex) {
......
...@@ -194,6 +194,18 @@ public class StandardContextLoaderTests { ...@@ -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 @Configuration
static class ConfigA { static class ConfigA {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment