public ConfigurableJsonMatcher<T> when(Option first, Option... next) { configuration = configuration.withOptions(first, next); return this; }
/** * Adds comparison options. * * @param first * @param next * @return */ public Configuration when(Option first, Option... next) { return withOptions(first, next); }
public ConfigurableJsonMatcher<T> withOptions(Options options) { configuration = configuration.withOptions(options); return this; }
/** * Adds comparison options. * * @param first * @param next * @return */ public Configuration when(Option first, Option... next) { return withOptions(first, next); }
public ConfigurableJsonMatcher<T> withOptions(Options options) { configuration = configuration.withOptions(options); return this; }
/** * Creates empty configuration and sets options. */ public static Configuration when(Option first, Option... next) { return Configuration.empty().withOptions(first, next); }
/** * Cleans all options. */ public static void resetOptions() { configuration = configuration.withOptions(Options.empty()); }
/** * Cleans all options. */ public static void resetOptions() { configuration = configuration.withOptions(Options.empty()); }
/** * Sets options changing comparison behavior. This method has to be called * <b>before</b> assertion. * For more info see {@link net.javacrumbs.jsonunit.core.Option} * * @param firstOption * @param otherOptions * @see net.javacrumbs.jsonunit.core.Option */ public ConfigurableJsonFluentAssert when(Option firstOption, Option... otherOptions) { return new ConfigurableJsonFluentAssert(actual, path, description, configuration.withOptions(firstOption, otherOptions)); } }
/** * Sets options changing comparison behavior. For more * details see {@link net.javacrumbs.jsonunit.core.Option} * * @see net.javacrumbs.jsonunit.core.Option */ public JsonUnitResultMatchers when(Option firstOption, Option... otherOptions) { return new JsonUnitResultMatchers(path, configuration.withOptions(firstOption, otherOptions)); }
/** * Sets comparison options. * * @param options * @return */ public ConfigurableJsonAssert withOptions(Options options) { return withConfiguration(c -> c.withOptions(options)); }
/** * Creates empty configuration and sets options. */ public static Configuration when(Option first, Option... next) { return Configuration.empty().withOptions(first, next); }
/** * Sets options changing comparison behavior. This method has to be called * <b>before</b> assertion. * For more info see {@link net.javacrumbs.jsonunit.core.Option} * * @param firstOption * @param otherOptions * @see net.javacrumbs.jsonunit.core.Option */ public ConfigurableJsonFluentAssert when(Option firstOption, Option... otherOptions) { return new ConfigurableJsonFluentAssert(actual, path, description, configuration.withOptions(firstOption, otherOptions)); } }
/** * When set to true, treats null nodes in actual value as absent. In other words * if you expect {"test":{"a":1}} this {"test":{"a":1, "b": null}} will pass the test. * * @deprecated use setOptions(Option.TREATING_NULL_AS_ABSENT) */ @Deprecated public static void setTreatNullAsAbsent(boolean treatNullAsAbsent) { if (treatNullAsAbsent) { configuration = configuration.withOptions(TREATING_NULL_AS_ABSENT); } else { configuration = configuration.withOptions(configuration.getOptions().without(TREATING_NULL_AS_ABSENT)); } }
/** * Compares structure of part of the JSON. Path has this format "root.array[0].value". * Is too lenient, ignores types, prefer IGNORING_VALUES option instead. * * @deprecated Use IGNORING_VALUES option instead */ @Deprecated public static void assertJsonPartStructureEquals(Object expected, Object fullJson, String path) { Diff diff = create(expected, fullJson, FULL_JSON, path, configuration.withOptions(COMPARING_ONLY_STRUCTURE)); diff.failIfDifferent(); }
/** * Compares structure of part of the JSON. Path has this format "root.array[0].value". * Is too lenient, ignores types, prefer IGNORING_VALUES option instead. * * @deprecated Use IGNORING_VALUES option instead */ @Deprecated public static void assertJsonPartStructureEquals(Object expected, Object fullJson, String path) { Diff diff = create(expected, fullJson, FULL_JSON, path, configuration.withOptions(COMPARING_ONLY_STRUCTURE)); diff.failIfDifferent(); }
/** * Compares structures of two JSON documents. Is too lenient, ignores types, prefer IGNORING_VALUES option instead. * Throws {@link AssertionError} if they are different. * * @deprecated Use IGNORING_VALUES option instead */ @Deprecated public static void assertJsonStructureEquals(Object expected, Object actual) { Diff diff = create(expected, actual, ACTUAL, ROOT, configuration.withOptions(COMPARING_ONLY_STRUCTURE)); diff.failIfDifferent(); }
/** * Compares structures of two JSON documents. Is too lenient, ignores types, prefer IGNORING_VALUES option instead. * Throws {@link AssertionError} if they are different. * * @deprecated Use IGNORING_VALUES option instead */ @Deprecated public static void assertJsonStructureEquals(Object expected, Object actual) { Diff diff = create(expected, actual, ACTUAL, ROOT, configuration.withOptions(COMPARING_ONLY_STRUCTURE)); diff.failIfDifferent(); }
/** * Sets options changing comparison behavior. For more * details see {@link net.javacrumbs.jsonunit.core.Option} * * @see net.javacrumbs.jsonunit.core.Option */ public static void setOptions(Option firstOption, Option... rest) { configuration = configuration.withOptions(Options.empty().with(firstOption, rest)); }
/** * Sets options changing comparison behavior. For more * details see {@link net.javacrumbs.jsonunit.core.Option} * * @see net.javacrumbs.jsonunit.core.Option */ public static void setOptions(Option firstOption, Option... rest) { configuration = configuration.withOptions(Options.empty().with(firstOption, rest)); }