Class BigDecimalSubject


public final class BigDecimalSubject extends ComparableSubject<BigDecimal>
A subject for BigDecimal values.
Author:
Kurt Alfred Kluever
  • Method Details

    • isEqualToIgnoringScale

      public void isEqualToIgnoringScale(BigDecimal expected)
      Checks that the actual value is equal to the value of the given BigDecimal. (i.e., checks that actual.comparesTo(expected) == 0).

      Note: The scale of the BigDecimal is ignored. If you want to compare the values and the scales, use isEqualTo(Object).

    • isEqualToIgnoringScale

      public void isEqualToIgnoringScale(String expected)
      Checks that the actual value is equal to the value of the BigDecimal created from the expected string (i.e., checks that actual.comparesTo(new BigDecimal(expected)) == 0).

      Note: The scale of the BigDecimal is ignored. If you want to compare the values and the scales, use isEqualTo(Object).

    • isEqualToIgnoringScale

      public void isEqualToIgnoringScale(long expected)
      Checks that the actual value is equal to the value of the BigDecimal created from the expected long (i.e., checks that actual.comparesTo(new BigDecimal(expected)) == 0).

      Note: The scale of the BigDecimal is ignored. If you want to compare the values and the scales, use isEqualTo(Object).

    • isEqualTo

      public void isEqualTo(@Nullable Object expected)
      Checks that the actual value (including scale) is equal to the given BigDecimal.

      Note: If you only want to compare the values of the BigDecimals and not their scales, use isEqualToIgnoringScale(BigDecimal) instead.

      Overrides:
      isEqualTo in class Subject
    • isEquivalentAccordingToCompareTo

      public void isEquivalentAccordingToCompareTo(@Nullable BigDecimal expected)
      Checks that the actual value is equivalent to the given value according to Comparable.compareTo(T), (i.e., checks that a.comparesTo(b) == 0). This method behaves identically to (the more clearly named) isEqualToIgnoringScale(BigDecimal).

      Note: Do not use this method for checking object equality. Instead, use isEqualTo(Object).

      Overrides:
      isEquivalentAccordingToCompareTo in class ComparableSubject<BigDecimal>