From e844c92465f7781f483805ca1ce7016009e1e6d6 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Fri, 14 Jul 2017 18:19:03 +0200 Subject: [PATCH] Expose AssertionErrors as is Closes gh-9760 --- .../boot/test/context/AbstractContextLoader.java | 2 +- .../test/context/StandardContextLoaderTests.java | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/AbstractContextLoader.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/AbstractContextLoader.java index dcd2bd2ea7..adb8987b83 100644 --- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/AbstractContextLoader.java +++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/AbstractContextLoader.java @@ -186,7 +186,7 @@ class AbstractContextLoader { + fail("This is expected"); + }); + } + catch (AssertionError ex) { + assertThat(ex.getMessage()).isEqualTo("This is expected"); + } + } + @Configuration static class ConfigA {