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>
Propositions forBigDecimal
typed subjects.- 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
isEqualTo(@Nullable Object expected)
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(@Nullable 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
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(BigDecimal expected)
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
public 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
).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
public void isEqualTo(@Nullable Object expected)
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
public void isEquivalentAccordingToCompareTo(@Nullable BigDecimal expected)
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>
-
-