From ff8edf8d9860cc9d68a30fa57d3043105f83e2f7 Mon Sep 17 00:00:00 2001 From: Camille Vienot Date: Wed, 26 Dec 2018 20:23:34 +0100 Subject: [PATCH] Use assertJ to generate AssertionError and filter its stacktrace Closes gh-15569 --- .../boot/test/json/JsonContentAssert.java | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) 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