Skip to content

Wrong error message for type mismatch in jsonPath().value() #25480

@g1patil

Description

@g1patil

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.

Metadata

Metadata

Assignees

Labels

in: testIssues in the test moduletype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions