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.

@FunctionalInterface public interface NumberComparator
Interface enabling customization of number comparison.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    compare(@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 value
      actual - actual value
      tolerance - tolerance
      Returns:
      true if the numbers should be considered equal