Class AbstractBigDecimalAssert<SELF extends AbstractBigDecimalAssert<SELF>>
- Type Parameters:
SELF
- the "self" type of this assertion class. Please read "Emulating 'self types' using Java Generics to simplify fluent API implementation" for more details.
- All Implemented Interfaces:
Assert<SELF,
,BigDecimal> ComparableAssert<SELF,
,BigDecimal> Descriptable<SELF>
,ExtensionPoints<SELF,
,BigDecimal> NumberAssert<SELF,
BigDecimal>
- Direct Known Subclasses:
BigDecimalAssert
BigDecimal
s.- Author:
- Drummond Dawson, David DIDIER, Ted M. Young, Yvonne Wang, Alex Ruiz, Joel Costigliola, Mikhail Mazursky
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractBigDecimalAssert
(BigDecimal actual, Class<?> selfType) -
Method Summary
Modifier and TypeMethodDescriptionhasScaleOf
(int expectedScale) Verifies the BigDecimal under test has the given scale.isBetween
(BigDecimal start, BigDecimal end) Verifies that the actual value is in [start, end] range (start and end included).isCloseTo
(BigDecimal expected, Offset<BigDecimal> offset) Verifies that the actual number is close to the given one within the given offset value.isCloseTo
(BigDecimal expected, Percentage percentage) Verifies that the actual number is close to the given one within the given percentage.
If difference is equal to the percentage value, assertion is considered valid.isEqualByComparingTo
(String expected) Same asisEqualByComparingTo(BigDecimal)
but takes care of converting given String toBigDecimal
.Same asisEqualTo(BigDecimal)
but takes care of converting given String toBigDecimal
for you.isGreaterThanOrEqualTo
(BigDecimal other) Verifies that the actual value is greater than or equal to the given one.isLessThanOrEqualTo
(BigDecimal other) Verifies that the actual value is less than or equal to the given one.Verifies that the actual value is negative.isNotCloseTo
(BigDecimal expected, Offset<BigDecimal> offset) Verifies that the actual number is not close to the given one by less than the given offset.isNotCloseTo
(BigDecimal expected, Percentage percentage) Verifies that the actual number is not close to the given one by the given percentage.
If difference is equal to the percentage value, the assertion fails.isNotEqualByComparingTo
(String notExpected) Same asisNotEqualByComparingTo(BigDecimal)
but takes care of converting given String toBigDecimal
.Verifies that the actual value is non negative (positive or equal zero).Verifies that the actual value is non positive (negative or equal zero).Verifies that the actual value is not equal to zero.isOne()
Verifies that the actual value is equal to one.Verifies that the actual value is positive.isStrictlyBetween
(BigDecimal start, BigDecimal end) Verifies that the actual value is in ]start, end[ range (start excluded, end excluded).isZero()
Verifies that the actual value is equal to zero.scale()
Returns anAssert
object that allows performing assertions on the scale of theBigDecimal
under test.usingComparator
(Comparator<? super BigDecimal> customComparator) Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks.usingComparator
(Comparator<? super BigDecimal> customComparator, String customComparatorDescription) Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks.Revert to standard comparison for the incoming assertion checks.Methods inherited from class org.assertj.core.api.AbstractComparableAssert
inBinary, inHexadecimal, isEqualByComparingTo, isGreaterThan, isLessThan, isNotEqualByComparingTo
Methods inherited from class org.assertj.core.api.AbstractObjectAssert
as, as, doesNotReturn, extracting, extracting, extracting, extracting, extracting, extracting, extractingForProxy, getComparatorsByType, hasAllNullFieldsOrProperties, hasAllNullFieldsOrPropertiesExcept, hasFieldOrProperty, hasFieldOrPropertyWithValue, hasNoNullFieldsOrProperties, hasNoNullFieldsOrPropertiesExcept, hasOnlyFields, isEqualToComparingFieldByField, isEqualToComparingFieldByFieldRecursively, isEqualToComparingOnlyGivenFields, isEqualToIgnoringGivenFields, isEqualToIgnoringNullFields, newObjectAssert, returns, usingComparatorForFields, usingComparatorForType, usingRecursiveComparison, usingRecursiveComparison
Methods inherited from class org.assertj.core.api.AbstractAssert
areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnError
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.assertj.core.api.Descriptable
as, describedAs
-
Constructor Details
-
AbstractBigDecimalAssert
-
-
Method Details
-
isZero
Verifies that the actual value is equal to zero.Example:
// assertions will pass assertThat(0).isZero(); assertThat(0.0).isZero(); // assertions will fail assertThat(42).isZero(); assertThat(3.142).isZero();
Example:
// assertion will pass assertThat(BigDecimal.ZERO).isZero(); // assertion will fail assertThat(new BigDecimal("8.00")).isZero();
- Specified by:
isZero
in interfaceNumberAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Returns:
- this assertion object.
-
isNotZero
Verifies that the actual value is not equal to zero.Example:
// assertions will pass assertThat(42).isNotZero(); assertThat(3.142).isNotZero(); // assertions will fail assertThat(0).isNotZero(); assertThat(0.0).isNotZero();
Example:
// assertion will pass assertThat(new BigDecimal("8.00")).isNotZero(); // assertion will fail assertThat(BigDecimal.ZERO).isNotZero();
- Specified by:
isNotZero
in interfaceNumberAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Returns:
- this assertion object.
-
isOne
Verifies that the actual value is equal to one.Example:
// assertions will pass assertThat(1).isOne(); assertThat(1.0).isOne(); // assertions will fail assertThat(42).isOne(); assertThat(3.142).isOne();
Example:
// assertion will pass assertThat(BigDecimal.ONE).isOne(); // assertion will fail assertThat(new BigDecimal("8.00")).isOne();
- Specified by:
isOne
in interfaceNumberAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Returns:
- this assertion object.
-
isPositive
Verifies that the actual value is positive.Example:
// assertions will pass assertThat(42).isPositive(); assertThat(3.142).isPositive(); // assertions will fail assertThat(0).isPositive(); assertThat(-42).isPositive();
Example:
// assertion will pass assertThat(new BigDecimal("8.0")).isPositive(); // assertion will fail assertThat(new BigDecimal("-8.0")).isPositive();
- Specified by:
isPositive
in interfaceNumberAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Returns:
- this assertion object.
-
isNegative
Verifies that the actual value is negative.Example:
// assertions will pass assertThat(-42).isNegative(); assertThat(-3.124).isNegative(); // assertions will fail assertThat(0).isNegative(); assertThat(42).isNegative();
Example:
// assertion will pass assertThat(new BigDecimal("-8.0")).isNegative(); // assertion will fail assertThat(new BigDecimal("8.0")).isNegative();
- Specified by:
isNegative
in interfaceNumberAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Returns:
- this assertion object.
-
isNotPositive
Verifies that the actual value is non positive (negative or equal zero).Example:
// assertions will pass assertThat(-42).isNotPositive(); assertThat(0).isNotPositive(); // assertions will fail assertThat(42).isNotPositive(); assertThat(3.124).isNotPositive();
Example:
// assertion will pass assertThat(new BigDecimal("-8.0")).isNotPositive(); // assertion will fail assertThat(new BigDecimal("8.0")).isNotPositive();
- Specified by:
isNotPositive
in interfaceNumberAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Returns:
this
assertion object.
-
isNotNegative
Verifies that the actual value is non negative (positive or equal zero).Example:
// assertions will pass assertThat(42).isNotNegative(); assertThat(0).isNotNegative(); // assertions will fail assertThat(-42).isNotNegative(); assertThat(-3.124).isNotNegative();
Example:
// assertion will pass assertThat(new BigDecimal("8.0")).isNotNegative(); // assertion will fail assertThat(new BigDecimal("-8.0")).isNotNegative();
- Specified by:
isNotNegative
in interfaceNumberAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Returns:
this
assertion object.
-
isBetween
Verifies that the actual value is in [start, end] range (start and end included).Example:
Note that comparison of// assertions will pass assertThat(new BigDecimal("8.0")).isBetween(new BigDecimal("7.0"), new BigDecimal("9.0")); assertThat(new BigDecimal("8.00")).isBetween(new BigDecimal("7.0"), new BigDecimal("9.0")); assertThat(new BigDecimal("8.0")).isBetween(new BigDecimal("8.0"), new BigDecimal("9.0")); assertThat(new BigDecimal("8.0")).isBetween(new BigDecimal("7.0"), new BigDecimal("8.0")); // comparison is performed without scale consideration: assertThat(new BigDecimal("8.0")).isBetween(new BigDecimal("8.0"), new BigDecimal("8.00")); // assertion will fail assertThat(new BigDecimal("8.0")).isBetween(new BigDecimal("6.0"), new BigDecimal("7.0"));
BigDecimal
is done by value without scale consideration, i.e 2.0 and 2.00 are considered equal in value unlikeBigDecimal.equals(Object)
.- Specified by:
isBetween
in interfaceComparableAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Specified by:
isBetween
in interfaceNumberAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Overrides:
isBetween
in classAbstractComparableAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Parameters:
start
- the start value (inclusive), expected not to be null.end
- the end value (inclusive), expected not to be null.- Returns:
- this assertion object.
-
isStrictlyBetween
Verifies that the actual value is in ]start, end[ range (start excluded, end excluded).Example:
// assertion will pass assertThat(new BigDecimal("8.0")).isStrictlyBetween(new BigDecimal("7.0"), new BigDecimal("9.0")); // assertions will fail assertThat(new BigDecimal("8.0")).isStrictlyBetween(new BigDecimal("8.0"), new BigDecimal("9.0")); assertThat(new BigDecimal("8.0")).isStrictlyBetween(new BigDecimal("7.0"), new BigDecimal("8.0"));
- Specified by:
isStrictlyBetween
in interfaceComparableAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Specified by:
isStrictlyBetween
in interfaceNumberAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Overrides:
isStrictlyBetween
in classAbstractComparableAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Parameters:
start
- the start value (exclusive), expected not to be null.end
- the end value (exclusive), expected not to be null.- Returns:
- this assertion object.
-
isEqualTo
Same asisEqualTo(BigDecimal)
but takes care of converting given String toBigDecimal
for you.Example:
// assertion will pass assertThat(new BigDecimal("8.0")).isEqualTo("8.0"); // assertion will fail because 8.00 is not equals to 8.0 assertThat(new BigDecimal("8.00")).isEqualTo("8.0");
- Parameters:
expected
- the given number to compare the actual value to.- Returns:
this
assertion object.
-
isEqualByComparingTo
Same asisEqualByComparingTo(BigDecimal)
but takes care of converting given String toBigDecimal
.Example:
// assertions will pass assertThat(new BigDecimal("8.0")).isEqualByComparingTo("8.0"); // assertion will pass because 8.0 is equals to 8.00 using
BigDecimal.compareTo(Object)
assertThat(new BigDecimal("8.0")).isEqualByComparingTo("8.00"); // assertion will fail assertThat(new BigDecimal("8.0")).isEqualByComparingTo("2.0");- Parameters:
expected
- the expectedBigDecimal
passed as a String- Returns:
this
assertion object.
-
isNotEqualByComparingTo
Same asisNotEqualByComparingTo(BigDecimal)
but takes care of converting given String toBigDecimal
.Example:
// assertions will pass assertThat(new BigDecimal("8.0")).isNotEqualByComparingTo("7.99"); // assertion will fail assertThat(new BigDecimal("8.0")).isNotEqualByComparingTo("8.00");
- Parameters:
notExpected
- theBigDecimal
value passed as a String not to expect.- Returns:
this
assertion object.
-
hasScaleOf
Verifies the BigDecimal under test has the given scale.Example:
// assertions will pass assertThat(new BigDecimal("8.00")).hasScaleOf(2); assertThat(new BigDecimal("8.00").setScale(4)).hasScaleOf(4); // assertion will fail assertThat(new BigDecimal("8.00")).hasScaleOf(3); assertThat(new BigDecimal("8.00").setScale(4)).hasScaleOf(2);
- Parameters:
expectedScale
- the expected scale value.- Returns:
this
assertion object.
-
usingComparator
Description copied from class:AbstractAssert
Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks.The custom comparator is bound to assertion instance, meaning that if a new assertion instance is created, the default comparison strategy will be used.
Examples :
// frodo and sam are instances of Character with Hobbit race (obviously :). // raceComparator implements Comparator<Character> assertThat(frodo).usingComparator(raceComparator).isEqualTo(sam);
- Specified by:
usingComparator
in interfaceAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Overrides:
usingComparator
in classAbstractComparableAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Parameters:
customComparator
- the comparator to use for the incoming assertion checks.- Returns:
this
assertion object.
-
usingComparator
public SELF usingComparator(Comparator<? super BigDecimal> customComparator, String customComparatorDescription) Description copied from class:AbstractAssert
Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks.The custom comparator is bound to assertion instance, meaning that if a new assertion instance is created, the default comparison strategy will be used.
Examples :
// frodo and sam are instances of Character with Hobbit race (obviously :). // raceComparator implements Comparator<Character> assertThat(frodo).usingComparator(raceComparator, "Hobbit Race Comparator").isEqualTo(sam);
- Specified by:
usingComparator
in interfaceAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Overrides:
usingComparator
in classAbstractComparableAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Parameters:
customComparator
- the comparator to use for the incoming assertion checks.customComparatorDescription
- comparator description to be used in assertion error messages- Returns:
this
assertion object.
-
usingDefaultComparator
Description copied from class:AbstractAssert
Revert to standard comparison for the incoming assertion checks.This method should be used to disable a custom comparison strategy set by calling
usingComparator
.- Specified by:
usingDefaultComparator
in interfaceAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Overrides:
usingDefaultComparator
in classAbstractComparableAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Returns:
this
assertion object.
-
isCloseTo
Verifies that the actual number is close to the given one within the given offset value.When abs(actual - expected) == offset value, the assertion:
- succeeds when using
Assertions.within(BigDecimal)
orOffset.offset(Number)
- fails when using
Assertions.byLessThan(BigDecimal)
orOffset.strictOffset(Number)
Breaking change since 2.9.0/3.9.0: using
Assertions.byLessThan(BigDecimal)
implies a strict comparison, useAssertions.within(BigDecimal)
to get the old behavior.Examples:
final BigDecimal eightDotOne = new BigDecimal("8.1"); final BigDecimal eight = new BigDecimal("8.0"); // assertions succeed assertThat(eightDotOne).isCloseTo(eight, within(new BigDecimal("0.2"))); assertThat(eightDotOne).isCloseTo(eight, byLessThan(new BigDecimal("0.2"))); // strict // assertions succeed when the difference == offset value ... assertThat(eightDotOne).isCloseTo(eight, within(new BigDecimal("0.1"))); // ... except when using byLessThan which implies a strict comparison assertThat(eightDotOne).isCloseTo(eight, byLessThan(new BigDecimal("0.1"))); // strict => fail // this assertion also fails assertThat(eightDotOne).isCloseTo(eight, within(new BigDecimal("0.001")));
- Specified by:
isCloseTo
in interfaceNumberAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Parameters:
expected
- the given number to compare the actual value to.offset
- the given positive offset.- Returns:
this
assertion object.- Throws:
NullPointerException
- if the given offset isnull
.NullPointerException
- if the expected number isnull
.AssertionError
- if the actual value is not close to the given one.
- succeeds when using
-
isNotCloseTo
Verifies that the actual number is not close to the given one by less than the given offset.
When abs(actual - expected) == offset value, the assertion:
- succeeds when using
Assertions.byLessThan(BigDecimal)
orOffset.strictOffset(Number)
- fails when using
Assertions.within(BigDecimal)
orOffset.offset(Number)
Breaking change since 2.9.0/3.9.0: using
Assertions.byLessThan(BigDecimal)
implies a strict comparison, useAssertions.within(BigDecimal)
to get the old behavior.Example:
final BigDecimal eightDotOne = new BigDecimal("8.1"); final BigDecimal eight = new BigDecimal("8.0"); // assertions succeed assertThat(eightDotOne).isNotCloseTo(eight, byLessThan(new BigDecimal("0.01"))); assertThat(eightDotOne).isNotCloseTo(eight, within(new BigDecimal("0.01"))); // diff == offset but isNotCloseTo succeeds as we use byLessThan assertThat(eightDotOne).isNotCloseTo(eight, byLessThan(new BigDecimal("0.1"))); // assertions fail assertThat(eightDotOne).isNotCloseTo(eight, within(new BigDecimal("0.1"))); assertThat(eightDotOne).isNotCloseTo(eight, within(new BigDecimal("0.2"))); assertThat(eightDotOne).isNotCloseTo(eight, byLessThan(new BigDecimal("0.2")));
- Specified by:
isNotCloseTo
in interfaceNumberAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Parameters:
expected
- the given number to compare the actual value to.offset
- the given positive offset.- Returns:
this
assertion object.- Throws:
NullPointerException
- if the given offset isnull
.NullPointerException
- if the expected number isnull
.AssertionError
- if the actual value is close to the given one.- Since:
- 2.6.0 / 3.6.0
- See Also:
- succeeds when using
-
isCloseTo
Verifies that the actual number is close to the given one within the given percentage.
If difference is equal to the percentage value, assertion is considered valid.Example with BigDecimal:
// assertions will pass: assertThat(BigDecimal.valueOf(11.0)).isCloseTo(BigDecimal.TEN, withinPercentage(BigDecimal.valueOf(20d))); // if difference is exactly equals to the computed offset (1.0), it's ok assertThat(BigDecimal.valueOf(11.0)).isCloseTo(BigDecimal.TEN, withinPercentage(BigDecimal.valueOf(10d))); // assertion will fail assertThat(BigDecimal.valueOf(11.0)).isCloseTo(BigDecimal.TEN, withinPercentage(BigDecimal.valueOf(5d)));
- Specified by:
isCloseTo
in interfaceNumberAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Parameters:
expected
- the given number to compare the actual value to.percentage
- the given positive percentage.- Returns:
this
assertion object.- Throws:
NullPointerException
- if the given offset isnull
.NullPointerException
- if the expected number isnull
.AssertionError
- if the actual value is not close to the given one.
-
isNotCloseTo
Verifies that the actual number is not close to the given one by the given percentage.
If difference is equal to the percentage value, the assertion fails.Example with BigDecimal:
BigDecimal eleven = BigDecimal.valueOf(11.0); // assertion will pass: assertThat(eleven).isNotCloseTo(BigDecimal.TEN, withinPercentage(new BigDecimal("5"))); // assertion will fail as the difference is exactly equals to the computed offset (1.0) assertThat(eleven).isNotCloseTo(BigDecimal.TEN, withinPercentage(new BigDecimal("10"))); // assertion will fail assertThat(eleven).isNotCloseTo(BigDecimal.TEN, withinPercentage(new BigDecimal("20")));
- Specified by:
isNotCloseTo
in interfaceNumberAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Parameters:
expected
- the given number to compare the actual value to.percentage
- the given positive percentage.- Returns:
this
assertion object.- Throws:
NullPointerException
- if the given offset isnull
.NullPointerException
- if the expected number isnull
.AssertionError
- if the actual value is close to the given one.
-
isLessThanOrEqualTo
Verifies that the actual value is less than or equal to the given one.Example:
Note that comparison of// assertions will pass assertThat(BigDecimal.ONE).isLessThanOrEqualTo(BigDecimal.TEN); assertThat(BigDecimal.ONE).isLessThanOrEqualTo(BigDecimal.ONE); // comparison is performed without scale consideration: assertThat(BigDecimal.ONE).isLessThanOrEqualTo(new BigDecimal("1.00")); // assertions will fail assertThat(BigDecimal.ONE).isLessThanOrEqualTo(BigDecimal.ZERO);
BigDecimal
is done by value without scale consideration, i.e 2.0 and 2.00 are considered equal in value unlikeBigDecimal.equals(Object)
.- Specified by:
isLessThanOrEqualTo
in interfaceComparableAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Overrides:
isLessThanOrEqualTo
in classAbstractComparableAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Parameters:
other
- the given value to compare the actual value to.- Returns:
this
assertion object.- Throws:
AssertionError
- if the actual value isnull
.AssertionError
- if the actual value is greater than the given one.
-
isGreaterThanOrEqualTo
Verifies that the actual value is greater than or equal to the given one.Example:
Note that comparison of// assertions will pass assertThat(BigDecimal.ONE).isGreaterThanOrEqualTo(BigDecimal.ZERO); assertThat(BigDecimal.ONE).isGreaterThanOrEqualTo(BigDecimal.ONE); // comparison is performed without scale consideration: assertThat(BigDecimal.ONE).isGreaterThanOrEqualTo(new BigDecimal("1.00")); // assertions will fail assertThat(BigDecimal.ZERO).isGreaterThanOrEqualTo(BigDecimal.ONE);
BigDecimal
is done by value without scale consideration, i.e 2.0 and 2.00 are considered equal in value unlikeBigDecimal.equals(Object)
.- Specified by:
isGreaterThanOrEqualTo
in interfaceComparableAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Overrides:
isGreaterThanOrEqualTo
in classAbstractComparableAssert<SELF extends AbstractBigDecimalAssert<SELF>,
BigDecimal> - Parameters:
other
- the given value to compare the actual value to.- Returns:
this
assertion object.- Throws:
AssertionError
- if the actual value isnull
.AssertionError
- if the actual value is less than the given one.
-
scale
Returns anAssert
object that allows performing assertions on the scale of theBigDecimal
under test.Once this method is called, the object under test is no longer the
BigDecimal
but its scale. To perform assertions on theBigDecimal
, callAbstractBigDecimalScaleAssert.returnToBigDecimal()
.Example:
BigDecimal bgDecimal = new BigDecimal("9.3231"); // assertions succeed assertThat(bgDecimal).scale().isGreaterThan(1) .isLessThan(5) .returnToBigDecimal().isPositive(); assertThat(bgDecimal.setScale(5)).scale().isLessThan(6); // assertions fails assertThat(bgDecimal).scale().isBetween(5, 8); assertThat(bgDecimal.setScale(5)).scale().isLessThan(5);
- Returns:
- AbstractBigDecimalScaleAssert built with the
BigDecimal
's scale. - Throws:
NullPointerException
- if the givenBigDecimal
isnull
.
-