Skip to content

Commit

Permalink
Fix reporting of JsonPath path
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-krecan committed Nov 29, 2024
1 parent 8e6ff8d commit 2e18570
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ public InternalMatcher(
this(actual, path, description, configuration, "Node \"" + path + "\"");
}

private InternalMatcher(@NotNull Object actual, @NotNull String pathPrefix) {
this(actual, Path.create("", pathPrefix), "", Configuration.empty());
}

@NotNull
public InternalMatcher whenIgnoringPaths(@NotNull String... pathsToBeIgnored) {
return new InternalMatcher(actual, path, description, configuration.whenIgnoringPaths(pathsToBeIgnored));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ void shouldAllowOptionsOnPath() throws Exception {
void shouldSupportJsonPath() throws Exception {
exec("/sampleProduces").andExpect(json().inPath("$.result.array[1]").isEqualTo(2));
}
@Test
void shouldSupportJsonPathError() throws Exception {
assertThatThrownBy(() ->
exec("/sampleProduces").andExpect(json().inPath("$.result.array[1]").isEqualTo(3))
).hasMessage("""
JSON documents are different:
Different value found in node "", expected: <3> but was: <2>.
""");
}


@Test
void shouldPassIfEqualsWithIsoEncoding() throws Exception {
Expand Down

0 comments on commit 2e18570

Please sign in to comment.