Package com.google.common.truth
Class BigDecimalSubject
- java.lang.Object
-
- com.google.common.truth.Subject
-
- com.google.common.truth.ComparableSubject<BigDecimal>
-
- com.google.common.truth.BigDecimalSubject
-
public final class BigDecimalSubject extends ComparableSubject<BigDecimal>
A subject forBigDecimal
values.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.truth.Subject
Subject.Factory<SubjectT extends Subject,ActualT>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
isEqualTo(@Nullable Object expected)
Checks that the actual value (including scale) is equal to the givenBigDecimal
.void
isEqualToIgnoringScale(long expected)
Checks that the actual value is equal to the value of theBigDecimal
created from the expectedlong
(i.e., checks thatactual.compareTo(new BigDecimal(expected)) == 0
).void
isEqualToIgnoringScale(@Nullable BigDecimal expected)
Checks that the actual value is equal to the value of the givenBigDecimal
.void
isEqualToIgnoringScale(String expected)
Checks that the actual value is equal to the value of theBigDecimal
created from the expected string (i.e., checks thatactual.compareTo(new BigDecimal(expected)) == 0
).void
isEquivalentAccordingToCompareTo(@Nullable BigDecimal expected)
Checks that the actual value is equivalent to the given value according toComparable.compareTo(T)
, (i.e., checks thata.compareTo(b) == 0
).-
Methods inherited from class com.google.common.truth.ComparableSubject
isAtLeast, isAtMost, isGreaterThan, isIn, isLessThan, isNotIn
-
Methods inherited from class com.google.common.truth.Subject
actualCustomStringRepresentation, check, equals, failWithActual, failWithActual, failWithoutActual, hashCode, ignoreCheck, isAnyOf, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameInstanceAs, isNull, isSameInstanceAs, toString
-
-
-
-
Method Detail
-
isEqualToIgnoringScale
public void isEqualToIgnoringScale(@Nullable BigDecimal expected)
Checks that the actual value is equal to the value of the givenBigDecimal
. (i.e., checks thatactual.compareTo(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 theBigDecimal
created from the expected string (i.e., checks thatactual.compareTo(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 theBigDecimal
created from the expectedlong
(i.e., checks thatactual.compareTo(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 givenBigDecimal
.Note: If you only want to compare the values of the BigDecimals and not their scales, use
isEqualToIgnoringScale(BigDecimal)
instead.
-
isEquivalentAccordingToCompareTo
public void isEquivalentAccordingToCompareTo(@Nullable BigDecimal expected)
Checks that the actual value is equivalent to the given value according toComparable.compareTo(T)
, (i.e., checks thata.compareTo(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 classComparableSubject<BigDecimal>
-
-