|
throw new AssertionError("No value at JSON path \"" + this.expression + "\"", ex); |
This is the code I was running
.andExpect(jsonPath("$.myRootObject.content").value(myObject.getContent()))
In json path the returned value has the datatype String. Somehow I wrongly put byte[] in the expected. myObject.getContent() returns byte[]. So I was trying to compare String with byte[]. The error received should be ClassCastException. No Value at JSON Path is misleading message.
So there is value at the JSON path, its just that there is mismatch in the type. Value is present , so thrown error should give more specific issue , which is with expected and not with actual.
spring-framework/spring-test/src/main/java/org/springframework/test/util/JsonPathExpectationsHelper.java
Line 295 in 87c5b5a
This is the code I was running
.andExpect(jsonPath("$.myRootObject.content").value(myObject.getContent()))In json path the returned value has the datatype
String. Somehow I wrongly putbyte[]in the expected.myObject.getContent()returnsbyte[]. So I was trying to compareStringwithbyte[]. The error received should beClassCastException.No Value at JSON Pathis misleading message.So there is value at the JSON path, its just that there is mismatch in the type. Value is present , so thrown error should give more specific issue , which is with expected and not with actual.