Class BigDecimalSubject
A subject for
BigDecimal
values.- Author:
- Kurt Alfred Kluever
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.common.truth.Subject
Subject.Factory<SubjectT extends Subject, ActualT>
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.comparesTo(new BigDecimal(expected)) == 0
).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.comparesTo(new BigDecimal(expected)) == 0
).void
isEqualToIgnoringScale
(BigDecimal expected) Checks that the actual value is equal to the value of the givenBigDecimal
.void
Checks that the actual value is equivalent to the given value according toComparable.compareTo(T)
, (i.e., checks thata.comparesTo(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 Details
-
isEqualToIgnoringScale
Checks that the actual value is equal to the value of the givenBigDecimal
. (i.e., checks thatactual.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
Checks that the actual value is equal to the value of theBigDecimal
created from the expected string (i.e., checks thatactual.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 theBigDecimal
created from the expectedlong
(i.e., checks thatactual.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
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
Checks that the actual value is equivalent to the given value according toComparable.compareTo(T)
, (i.e., checks thata.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 classComparableSubject<BigDecimal>
-