Class BigDecimalSubject
A subject for
BigDecimal values.-
Nested Class Summary
Nested classes/interfaces inherited from class Subject
Subject.Factory<SubjectT,ActualT> -
Method Summary
Modifier and TypeMethodDescriptionvoidChecks that the actual value (including scale) is equal to the givenBigDecimal.voidisEqualToIgnoringScale(long expected) Checks that the actual value is equal to the value of theBigDecimalcreated from the expectedlong(i.e., checks thatactual.compareTo(new BigDecimal(expected)) == 0).voidisEqualToIgnoringScale(String expected) Checks that the actual value is equal to the value of theBigDecimalcreated from the expected string (i.e., checks thatactual.compareTo(new BigDecimal(expected)) == 0).voidisEqualToIgnoringScale(@Nullable BigDecimal expected) Checks that the actual value is equal to the value of the givenBigDecimal.voidChecks 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 ComparableSubject
isAtLeast, isAtMost, isGreaterThan, isIn, isLessThan, isNotInModifier and TypeMethodDescriptionfinal voidisAtLeast(BigDecimal other) Checks that the actual value is greater than or equal toother.final voidisAtMost(BigDecimal other) Checks that the actual value is less than or equal toother.final voidisGreaterThan(BigDecimal other) Checks that the actual value is greater thanother.final voidisIn(@Nullable Range<BigDecimal> range) Checks that the actual value is inrange.final voidisLessThan(BigDecimal other) Checks that the actual value is less thanother.final voidisNotIn(@Nullable Range<BigDecimal> range) Checks that the actual value is not inrange.Methods inherited from class Subject
actualCustomStringRepresentation, check, equals, failWithActual, failWithActual, failWithoutActual, hashCode, ignoreCheck, isAnyOf, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameInstanceAs, isNull, isSameInstanceAs, toStringModifier and TypeMethodDescriptionprotected StringReturns a string representation of the actual value for inclusion in failure messages.protected final StandardSubjectBuilderReturns a builder for creating a derived subject.final booleanDeprecated.protected final voidfailWithActual(Fact first, Fact... rest) Fails, reporting a message with the given facts, followed by an automatically added fact of the form: but was: actual value.protected final voidfailWithActual(String key, @Nullable Object value) Fails, reporting a message with two "facts": key: value but was: actual value.protected final voidfailWithoutActual(Fact first, Fact... rest) Fails, reporting a message with the given facts, without automatically adding the actual value.final inthashCode()Deprecated.Object.hashCode()is not supported on Truth subjects.protected final StandardSubjectBuilderBegins a new call chain that ignores any failures.voidChecks that the value under test is equal to any of the given elements.voidChecks that the value under test is equal to any element in the given iterable.voidisInstanceOf(@Nullable Class<?> clazz) Checks that the value under test is an instance of the given class.voidChecks that the value under test is not equal to any of the given elements.voidisNotEqualTo(@Nullable Object other) Checks that the value under test is not equal to the given object.voidChecks that the value under test is not equal to any element in the given iterable.voidisNotInstanceOf(@Nullable Class<?> clazz) Checks that the value under test is not an instance of the given class.voidChecks that the value under test is not null.final voidisNotSameInstanceAs(@Nullable Object other) Checks that the value under test is not the same instance as the given object.voidisNull()Checks that the value under test is null.final voidisSameInstanceAs(@Nullable Object expected) Checks that the value under test is the same instance as the given object.toString()Deprecated.Object.toString()is not supported on Truth subjects.
-
Method Details
-
isEqualToIgnoringScale
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
Checks that the actual value is equal to the value of theBigDecimalcreated 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 theBigDecimalcreated 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
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.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:
isEquivalentAccordingToCompareToin classComparableSubject<BigDecimal>
-
Object.equals(Object)is not supported on Truth subjects.