mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-05-03 04:19:47 +01:00
Make JsonPathAssertions#isEqualTo parameter nullable
Closes gh-35445
This commit is contained in:
+1
-1
@@ -56,7 +56,7 @@ public class JsonPathAssertions {
|
||||
/**
|
||||
* Applies {@link JsonPathExpectationsHelper#assertValue(String, Object)}.
|
||||
*/
|
||||
public WebTestClient.BodyContentSpec isEqualTo(Object expectedValue) {
|
||||
public WebTestClient.BodyContentSpec isEqualTo(@Nullable Object expectedValue) {
|
||||
this.pathHelper.assertValue(this.content, expectedValue);
|
||||
return this.bodySpec;
|
||||
}
|
||||
|
||||
+7
-1
@@ -57,7 +57,8 @@ class JsonPathExpectationsHelperTests {
|
||||
'whitespace': ' ',
|
||||
'emptyString': '',
|
||||
'emptyArray': [],
|
||||
'emptyMap': {}
|
||||
'emptyMap': {},
|
||||
'nullValue': null
|
||||
}""";
|
||||
|
||||
private static final String SIMPSONS = """
|
||||
@@ -249,6 +250,11 @@ class JsonPathExpectationsHelperTests {
|
||||
new JsonPathExpectationsHelper("$.num").assertValue(CONTENT, 5);
|
||||
}
|
||||
|
||||
@Test
|
||||
void assertNullValue() {
|
||||
new JsonPathExpectationsHelper("$.nullValue").assertValue(CONTENT, (Object) null);
|
||||
}
|
||||
|
||||
@Test // SPR-14498
|
||||
void assertValueWithNumberConversion() {
|
||||
new JsonPathExpectationsHelper("$.num").assertValue(CONTENT, 5.0);
|
||||
|
||||
Reference in New Issue
Block a user