/** * Sets the tolerance for floating number comparison. If set to null, requires exact match of the values. * For example, if set to 0.01, ignores all differences lower than 0.01, so 1 and 0.9999 are considered equal. */ public static void setTolerance(BigDecimal numericComparisonTolerance) { configuration = configuration.withTolerance(numericComparisonTolerance); }
/** * Sets the tolerance for floating number comparison. If set to null, requires exact match of the values. * For example, if set to 0.01, ignores all differences lower than 0.01, so 1 and 0.9999 are considered equal. */ public static void setTolerance(double numberComparisonTolerance) { configuration = configuration.withTolerance(numberComparisonTolerance); }
/** * Sets the tolerance for floating number comparison. If set to null, requires exact match of the values. * For example, if set to 0.01, ignores all differences lower than 0.01, so 1 and 0.9999 are considered equal. */ public static void setTolerance(BigDecimal numericComparisonTolerance) { configuration = configuration.withTolerance(numericComparisonTolerance); }
/** * Sets the tolerance for floating number comparison. If set to null, requires exact match of the values. * For example, if set to 0.01, ignores all differences lower than 0.01, so 1 and 0.9999 are considered equal. */ public static void setTolerance(double numberComparisonTolerance) { configuration = configuration.withTolerance(numberComparisonTolerance); }
public ConfigurableJsonMatcher<T> withTolerance(BigDecimal tolerance) { configuration = configuration.withTolerance(tolerance); return this; }
public ConfigurableJsonMatcher<T> withTolerance(double tolerance) { configuration = configuration.withTolerance(tolerance); return this; }
public ConfigurableJsonMatcher<T> withTolerance(BigDecimal tolerance) { configuration = configuration.withTolerance(tolerance); return this; }
public ConfigurableJsonMatcher<T> withTolerance(double tolerance) { configuration = configuration.withTolerance(tolerance); return this; }
/** * Sets numerical comparison tolerance. * * @param tolerance * @return */ public Configuration withTolerance(double tolerance) { return withTolerance(BigDecimal.valueOf(tolerance)); }
/** * Sets numerical comparison tolerance. * * @param tolerance * @return */ public Configuration withTolerance(double tolerance) { return withTolerance(BigDecimal.valueOf(tolerance)); }
/** * Creates empty configuration and sets numerical comparison tolerance. */ public static Configuration withTolerance(double tolerance) { return Configuration.empty().withTolerance(tolerance); }
/** * Creates empty configuration and sets numerical comparison tolerance. */ public static Configuration withTolerance(BigDecimal tolerance) { return Configuration.empty().withTolerance(tolerance); }
/** * Sets numerical comparison tolerance. * * @param tolerance * @return */ public ConfigurableJsonAssert withTolerance(BigDecimal tolerance) { return withConfiguration(c -> c.withTolerance(tolerance)); }
/** * Sets the tolerance for floating number comparison. If set to null, requires exact match of the values. * For example, if set to 0.01, ignores all differences lower than 0.01, so 1 and 0.9999 are considered equal. * * @param tolerance */ public ConfigurableJsonFluentAssert withTolerance(BigDecimal tolerance) { return new ConfigurableJsonFluentAssert(actual, path, description, configuration.withTolerance(tolerance)); }
/** * Creates empty configuration and sets numerical comparison tolerance. */ public static Configuration withTolerance(double tolerance) { return Configuration.empty().withTolerance(tolerance); }
/** * Creates empty configuration and sets numerical comparison tolerance. */ public static Configuration withTolerance(BigDecimal tolerance) { return Configuration.empty().withTolerance(tolerance); }
/** * Sets the tolerance for floating number comparison. If set to null, requires exact match of the values. * For example, if set to 0.01, ignores all differences lower than 0.01, so 1 and 0.9999 are considered equal. */ public JsonUnitResultMatchers withTolerance(BigDecimal tolerance) { return new JsonUnitResultMatchers(path, configuration.withTolerance(tolerance)); }
/** * Sets the tolerance for floating number comparison. If set to null, requires exact match of the values. * For example, if set to 0.01, ignores all differences lower than 0.01, so 1 and 0.9999 are considered equal. * * @param tolerance */ public ConfigurableJsonFluentAssert withTolerance(BigDecimal tolerance) { return new ConfigurableJsonFluentAssert(actual, path, description, configuration.withTolerance(tolerance)); }
@Test void testAssertTolerance() { assertThatJson("{\"test\":1.00001}").withConfiguration(c -> c.withTolerance(0.001)).isEqualTo("{\"test\":1}"); }