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 voidcompareValues(BigDecimal expected) voidFails if the subject's value and scale is not equal to the givenBigDecimal.voidisEqualToIgnoringScale(long expected) Fails if the subject's value is not equal to the value of theBigDecimalcreated from the expectedlong(i.e., fails ifactual.comparesTo(new BigDecimal(expected)) != 0).voidisEqualToIgnoringScale(String expected) Fails if the subject's value is not equal to the value of theBigDecimalcreated from the expected string (i.e., fails ifactual.comparesTo(new BigDecimal(expected)) != 0).voidisEqualToIgnoringScale(BigDecimal expected) Fails if the subject's value is not equal to the value of the givenBigDecimal.voidisEquivalentAccordingToCompareTo(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, isNotInMethods 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 theBigDecimalcreated 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 theBigDecimalcreated 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:
isEquivalentAccordingToCompareToin classComparableSubject<BigDecimal>
-
compareValues
-