Class BigDecimalSubject


public final class BigDecimalSubject extends ComparableSubject<BigDecimal>
Propositions for BigDecimal typed subjects.
  • Field Details

  • Constructor Details

  • Method Details

    • isEqualToIgnoringScale

      public void isEqualToIgnoringScale(BigDecimal expected)
      Fails if the subject's value is not equal to the value of the given BigDecimal. (i.e., fails if 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)
      Fails if the subject's value is not equal to the value of the BigDecimal created from the expected string (i.e., fails if 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)
      Fails if the subject's value is not equal to the value of the BigDecimal created from the expected long (i.e., fails if 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(Object expected)
      Fails if the subject's value and scale is not 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(BigDecimal expected)
      Fails if the subject is not equivalent to the given value according to Comparable.compareTo(T), (i.e., fails if 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>
    • compareValues

      private void compareValues(BigDecimal expected)