Package net.javacrumbs.jsonunit.core
Interface NumberComparator
- All Known Implementing Classes:
DefaultNumberComparator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Interface enabling customization of number comparison.
-
Method Summary
Modifier and TypeMethodDescriptionbooleancompare(@NotNull BigDecimal expected, @NotNull BigDecimal actual, @Nullable BigDecimal tolerance) Compares two numbers.
-
Method Details
-
compare
boolean compare(@NotNull @NotNull BigDecimal expected, @NotNull @NotNull BigDecimal actual, @Nullable @Nullable BigDecimal tolerance) Compares two numbers. Can be customized according to the needs, especially when comparing floating point numbers. Is 7 == 7.0? Is 7.0 == 7.00? Now you can choose.- Parameters:
expected- expected valueactual- actual valuetolerance- tolerance- Returns:
- true if the numbers should be considered equal
-