Skip to content

Commit

Permalink
#465 Fix assert
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-krecan committed Feb 7, 2022
1 parent 2ae5c04 commit a36e966
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@

import static net.javacrumbs.jsonunit.core.internal.JsonUtils.wrapDeserializedObject;

public class JsonListAssert extends FactoryBasedNavigableListAssert<JsonListAssert, List<?>, Object, JsonObjectAssert> {
public class JsonListAssert extends FactoryBasedNavigableListAssert<JsonListAssert, List<?>, Object, JsonAssert> {
private final Configuration configuration;
private final Path path;

JsonListAssert(List<?> actual, Path path, Configuration configuration) {
super(actual, JsonListAssert.class, t -> new JsonObjectAssert(t, path, configuration));
super(actual, JsonListAssert.class, t -> new JsonAssert(path, configuration, t));
this.path = path;
this.configuration = configuration;
usingComparator(new JsonComparator(configuration, path, true));
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -1630,6 +1630,21 @@ void testArrayBug() {
.isEqualTo(json("{\"value\": \"1\", \"title\": \"Entity\", \"info\": \"Entity info\"}"));
}

@Test
void testArrayNode() {
assertThatJson("[\n" +
" {\"value\": \"1\", \"title\": \"Entity\", \"info\": \"Entity info\"},\n" +
" {\"value\": \"2\", \"title\": \"Column\", \"info\": \"Column info\"},\n" +
" {\"value\": \"3\", \"title\": \"Table\", \"info\": \"Table info\"},\n" +
" {\"value\": \"4\", \"title\": \"Schema\", \"info\": \"Schema info\"}\n" +
" ]")
.inPath("$[?(@.value =='1')]")
.isArray().first()
.node("title")
.isString()
.isEqualTo("Entity");
}

@Test
void testInnerString() {
String json = "{\"myNode\":{\"inner\":\"foo\"}}";
Expand Down

0 comments on commit a36e966

Please sign in to comment.