Fixes missing casting; fixes gh-764

This commit is contained in:
Marcin Grzejszczak
2018-10-23 22:53:23 +02:00
parent 6bbd2dcede
commit 2d5c2dd931
4 changed files with 5 additions and 5 deletions

View File

@@ -492,7 +492,7 @@ abstract class MethodBodyBuilder {
protected void methodForNullCheck(BodyMatcher bodyMatcher, BlockBuilder bb) {
String quotedAndEscaptedPath = quotedAndEscaped(bodyMatcher.path())
String method = "assertThat(parsedJson.read(${quotedAndEscaptedPath})).isNull()"
String method = "assertThat((Object) parsedJson.read(${quotedAndEscaptedPath})).isNull()"
bb.addLine(postProcessJsonPathCall(method))
addColonIfRequired(bb)
}

View File

@@ -189,7 +189,7 @@ class MockMvcMethodBodyBuilderWithMatchersSpec extends Specification implements
test.contains('assertThat((java.lang.Iterable) parsedJson.read("' + rootElement + '.valueWithMaxEmpty", java.util.Collection.class)).as("' + rootElement + '.valueWithMaxEmpty").hasSizeLessThanOrEqualTo(0)')
test.contains('assertThatValueIsANumber(parsedJson.read("' + rootElement + '.duck")')
test.contains('assertThat(parsedJson.read("' + rootElement + '''.['key'].['complex.key']", String.class)).isEqualTo("foo")''')
test.contains('assertThat(parsedJson.read("' + rootElement + '.nullValue")).isNull()')
test.contains('assertThat((Object) parsedJson.read("' + rootElement + '.nullValue")).isNull()')
!test.contains('cursor')
and:
try {