public ConfigurableJsonMatcher<T> whenIgnoringPaths(String... paths) { configuration = configuration.whenIgnoringPaths(paths); return this; }
public ConfigurableJsonMatcher<T> whenIgnoringPaths(String... paths) { configuration = configuration.whenIgnoringPaths(paths); return this; }
/** * Sets paths to be ignored. */ public static Configuration whenIgnoringPaths(String... paths) { return Configuration.empty().whenIgnoringPaths(paths); }
@Override public JsonMapAssert isEqualToIgnoringGivenFields(Object other, String... propertiesOrFieldsToIgnore) { return compare(other, configuration.whenIgnoringPaths(propertiesOrFieldsToIgnore)); }
public ConfigurableJsonAssert whenIgnoringPaths(String... pathsToBeIgnored) { return withConfiguration(c -> c.whenIgnoringPaths(pathsToBeIgnored)); }
/** * Sets paths to be ignored. */ public static Configuration whenIgnoringPaths(String... paths) { return Configuration.empty().whenIgnoringPaths(paths); }
/** * Adds paths to be ignored */ public ConfigurableJsonFluentAssert whenIgnoringPaths(String... pathsToBeIgnored) { return new ConfigurableJsonFluentAssert(actual, path, description, configuration.whenIgnoringPaths(pathsToBeIgnored)); }
/** * Adds paths to be ignored */ public ConfigurableJsonFluentAssert whenIgnoringPaths(String... pathsToBeIgnored) { return new ConfigurableJsonFluentAssert(actual, path, description, configuration.whenIgnoringPaths(pathsToBeIgnored)); }
@Test void pathShouldBeIgnoredForExtraKey() { assertThatJson("{\"root\":{\"test\":1, \"ignored\": 1}}") .withConfiguration(c -> c.whenIgnoringPaths("root.ignored")) .isEqualTo("{\"root\":{\"test\":1}}"); }
@Test void jsonPathWithIgnoredPaths() { assertThatJson(json) .withConfiguration(c -> c.whenIgnoringPaths("$.store.book[*].price")) .inPath("$.store.book[0]") .isEqualTo( " {\n" + " \"category\": \"reference\",\n" + " \"author\": \"Nigel Rees\",\n" + " \"title\": \"Sayings of the Century\",\n" + " \"price\": 999\n" + " }" ); }