Dariusz Kuc
01/13/2020, 5:40 PMtestClient.get()
.uri("whatever")
.accept(APPLICATION_JSON)
.exchange()
.expectStatus().isOk
.expectBody()
.jsonPath("$.whatever").isEqualTo(null) // NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS
If I enable jsr305=strict
compiler settings the above fails complaining it expects non-null Any
IsNull.nullValue
I'm getting expected:<null> but was:<null>
isEqualTo
ends up calling
public void assertValue(String content, @Nullable Object expectedValue)
which allows nullable valuejsonPath("$.whatever").value<String?> {
assertNull(it)
}
Ben
01/13/2020, 9:48 PMnull
or are you just asserting that the field isn't there?Dariusz Kuc
01/13/2020, 9:50 PM{
"whatever": null
}
Ben
01/13/2020, 10:45 PM.json("""{"whatever":null}""")