diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContentAssert.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContentAssert.java index 166e2765bf8..31843244f37 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContentAssert.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContentAssert.java @@ -45,6 +45,7 @@ import org.springframework.util.StringUtils; * * @author Phillip Webb * @author Andy Wilkinson + * @author Camille Vienot * @since 1.4.0 */ public class JsonContentAssert extends AbstractAssert { @@ -96,7 +97,8 @@ public class JsonContentAssert extends AbstractAssert type, String expectedDescription) { Object value = getValue(true); if (value == null || isIndefiniteAndEmpty()) { - throw new AssertionError(getNoValueMessage()); + failWithMessage(getNoValueMessage()); } if (type != null && !type.isInstance(value)) { - throw new AssertionError(getExpectedValueMessage(expectedDescription)); + failWithMessage(getExpectedValueMessage(expectedDescription)); } } @@ -1089,7 +1092,7 @@ public class JsonContentAssert extends AbstractAssert