Package com.google.common.truth
Class BigDecimalSubject
Propositions for
BigDecimal
typed subjects.-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.common.truth.Subject
Subject.EqualityCheck, Subject.Factory<SubjectT extends Subject,
ActualT> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
compareValues
(BigDecimal expected) void
Fails if the subject's value and scale is not equal to the givenBigDecimal
.void
isEqualToIgnoringScale
(long expected) Fails if the subject's value is not equal to the value of theBigDecimal
created from the expectedlong
(i.e., fails ifactual.comparesTo(new BigDecimal(expected)) != 0
).void
isEqualToIgnoringScale
(String expected) Fails if the subject's value is not equal to the value of theBigDecimal
created from the expected string (i.e., fails ifactual.comparesTo(new BigDecimal(expected)) != 0
).void
isEqualToIgnoringScale
(BigDecimal expected) Fails if the subject's value is not equal to the value of the givenBigDecimal
.void
isEquivalentAccordingToCompareTo
(BigDecimal expected) Fails if the subject is not equivalent to the given value according toComparable.compareTo(T)
, (i.e., fails ifa.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
actual, actualCustomStringRepresentation, actualCustomStringRepresentationForPackageMembersToCall, butWas, check, check, checkNoNeedToDisplayBothValues, equals, fail, fail, fail, failEqualityCheckForEqualsWithoutDescription, failWithActual, failWithActual, failWithActual, failWithActual, failWithBadResults, failWithCustomSubject, failWithoutActual, failWithoutActual, failWithoutActual, failWithoutActual, failWithoutSubject, hashCode, ignoreCheck, isAnyOf, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameInstanceAs, isNull, isSameInstanceAs, toString, typeDescription
-
Field Details
-
actual
-
-
Constructor Details
-
BigDecimalSubject
BigDecimalSubject(FailureMetadata metadata, BigDecimal actual)
-
-
Method Details
-
isEqualToIgnoringScale
Fails if the subject's value is not equal to the value of the givenBigDecimal
. (i.e., fails ifactual.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
Fails if the subject's value is not equal to the value of theBigDecimal
created from the expected string (i.e., fails ifactual.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 theBigDecimal
created from the expectedlong
(i.e., fails ifactual.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
Fails if the subject's value and scale is not 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
Fails if the subject is not equivalent to the given value according toComparable.compareTo(T)
, (i.e., fails ifa.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>
-
compareValues
-