Package org.fest.assertions
Class BigDecimalAssert
- All Implemented Interfaces:
NumberAssert
Understands assertion methods for
BigDecimal
. To create a new instance of this class use the
method Assertions.assertThat(BigDecimal)
.-
Field Summary
Fields inherited from class org.fest.assertions.GenericAssert
actual
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BigDecimalAssert
(BigDecimal actual) Creates a newBigDecimalAssert
. -
Method Summary
Modifier and TypeMethodDescriptionSets the description of the actual value, to be used in as message of any
thrown when an assertion fails.AssertionError
as
(Description description) Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails.AssertionError
describedAs
(String description) Alias for
, since "as" is a keyword in Groovy.GenericAssert.as(String)
describedAs
(Description description) Alias for
, since "as" is a keyword in Groovy.GenericAssert.as(Description)
doesNotSatisfy
(Condition<BigDecimal> condition) Verifies that the actual
does not satisfy the given condition.BigDecimal
is
(Condition<BigDecimal> condition) Alias for
.satisfies(Condition)
isEqualByComparingTo
(BigDecimal expected) Verifies that the actual
is equal to the given one.BigDecimal
isEqualTo
(BigDecimal expected) Verifies that the actual
is equal to the given one.BigDecimal
isGreaterThan
(BigDecimal other) Verifies that the actual
value is greater than the given one.BigDecimal
isGreaterThanOrEqualTo
(BigDecimal other) Verifies that the actual
value is greater than or equal to the given one.BigDecimal
isLessThan
(BigDecimal other) Verifies that the actual
value is less than the given one.BigDecimal
isLessThanOrEqualTo
(BigDecimal other) Verifies that the actual
value is less than or equal to the given one.BigDecimal
Verifies that the actual
is negative.BigDecimal
isNot
(Condition<BigDecimal> condition) Alias for
.doesNotSatisfy(Condition)
isNotEqualByComparingTo
(BigDecimal expected) Verifies that the actual
is not equal to the given one.BigDecimal
isNotEqualTo
(BigDecimal other) Verifies that the actual
is not equal to the given one.BigDecimal
Verifies that the actual
is notBigDecimal
null
.isNotSameAs
(BigDecimal other) Verifies that the actual
is not the same as the given one.BigDecimal
Verifies that the actual
is not equal to zero, regardless of precision.BigDecimal
Verifies that the actual
is positive.BigDecimal
isSameAs
(BigDecimal expected) Verifies that the actual
is the same as the given one.BigDecimal
isZero()
Verifies that the actual
is equal to zero, regardless of precision.BigDecimal
overridingErrorMessage
(String message) Replaces the default message displayed in case of a failure with the given one.satisfies
(Condition<BigDecimal> condition) Verifies that the actual
satisfies the given condition.BigDecimal
Methods inherited from class org.fest.assertions.ComparableAssert
assertIsEqualByComparingTo, assertIsGreaterThan, assertIsGreaterThanOrEqualTo, assertIsLessThan, assertIsLessThanOrEqualTo, assertIsNotEqualByComparingTo
Methods inherited from class org.fest.assertions.GenericAssert
assertDoesNotSatisfy, assertEqualTo, assertIs, assertIsNot, assertNotEqualTo, assertNotNull, assertNotSameAs, assertSameAs, assertSatisfies, isNull
Methods inherited from class org.fest.assertions.Assert
customErrorMessage, description, description, description, equals, fail, fail, failIfCustomMessageIsSet, failIfCustomMessageIsSet, failure, formattedErrorMessage, hashCode, rawDescription, replaceDefaultErrorMessagesWith
-
Constructor Details
-
BigDecimalAssert
Creates a newBigDecimalAssert
.- Parameters:
actual
- the target to verify.
-
-
Method Details
-
as
Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails. This method should be called before any assertion method, otherwise any assertion failure will not show the provided description.AssertionError
For example:
assertThat(val).as("name").isEqualTo("Frodo");
- Specified by:
as
in classGenericAssert<BigDecimal>
- Parameters:
description
- the description of the actual value.- Returns:
- this assertion object.
-
describedAs
Alias for
, since "as" is a keyword in Groovy. This method should be called before any assertion method, otherwise any assertion failure will not show the provided description.GenericAssert.as(String)
For example:
assertThat(val).describedAs("name").isEqualTo("Frodo");
- Specified by:
describedAs
in classGenericAssert<BigDecimal>
- Parameters:
description
- the description of the actual value.- Returns:
- this assertion object.
-
as
Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails. This method should be called before any assertion method, otherwise any assertion failure will not show the provided description.AssertionError
For example:
assertThat(val).as(new BasicDescription("name")).isEqualTo("Frodo");
- Specified by:
as
in classGenericAssert<BigDecimal>
- Parameters:
description
- the description of the actual value.- Returns:
- this assertion object.
-
describedAs
Alias for
, since "as" is a keyword in Groovy. This method should be called before any assertion method, otherwise any assertion failure will not show the provided description.GenericAssert.as(Description)
For example:
assertThat(val).describedAs(new BasicDescription("name")).isEqualTo("Frodo");
- Specified by:
describedAs
in classGenericAssert<BigDecimal>
- Parameters:
description
- the description of the actual value.- Returns:
- this assertion object.
-
satisfies
Verifies that the actual
satisfies the given condition.BigDecimal
- Specified by:
satisfies
in classGenericAssert<BigDecimal>
- Parameters:
condition
- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException
- if the given condition isnull
.AssertionError
- if the actualBigDecimal
does not satisfy the given condition.- See Also:
-
doesNotSatisfy
Verifies that the actual
does not satisfy the given condition.BigDecimal
- Specified by:
doesNotSatisfy
in classGenericAssert<BigDecimal>
- Parameters:
condition
- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException
- if the given condition isnull
.AssertionError
- if the actual value does satisfies the given condition.- See Also:
-
is
Alias for
.satisfies(Condition)
- Specified by:
is
in classGenericAssert<BigDecimal>
- Parameters:
condition
- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException
- if the given condition isnull
.AssertionError
- if the actualBigDecimal
does not satisfy the given condition.- Since:
- 1.2
-
isNot
Alias for
.doesNotSatisfy(Condition)
- Specified by:
isNot
in classGenericAssert<BigDecimal>
- Parameters:
condition
- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException
- if the given condition isnull
.AssertionError
- if the actual value does satisfies the given condition.- Since:
- 1.2
-
isPositive
Verifies that the actual
is positive.BigDecimal
- Specified by:
isPositive
in interfaceNumberAssert
- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualBigDecimal
value isnull
.AssertionError
- if the actualBigDecimal
value is not positive.
-
isNegative
Verifies that the actual
is negative.BigDecimal
- Specified by:
isNegative
in interfaceNumberAssert
- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualBigDecimal
value isnull
.AssertionError
- if the actualBigDecimal
value is not negative.
-
isZero
Verifies that the actual
is equal to zero, regardless of precision. Essentially, this is the same asBigDecimal
(isEqualByComparingTo
).BigDecimal.ZERO
- Specified by:
isZero
in interfaceNumberAssert
- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualBigDecimal
value isnull
.AssertionError
- if the actualBigDecimal
value is not equal to zero.
-
isNotNull
Verifies that the actual
is notBigDecimal
null
.- Specified by:
isNotNull
in classGenericAssert<BigDecimal>
- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualBigDecimal
value isnull
.
-
isSameAs
Verifies that the actual
is the same as the given one.BigDecimal
- Specified by:
isSameAs
in classGenericAssert<BigDecimal>
- Parameters:
expected
- the givenBigDecimal
to compare the actualBigDecimal
to.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualBigDecimal
value is not the same as the given one.
-
isNotSameAs
Verifies that the actual
is not the same as the given one.BigDecimal
- Specified by:
isNotSameAs
in classGenericAssert<BigDecimal>
- Parameters:
other
- the givenBigDecimal
to compare the actualBigDecimal
to.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualBigDecimal
value is the same as the given one.
-
isEqualTo
Verifies that the actual
is equal to the given one. UnlikeBigDecimal
, this method considers twoisEqualByComparingTo(BigDecimal)
objects equal only if they are equal in value and scale (thus 2.0 is not equal to 2.00 when compared by this method).BigDecimal
- Specified by:
isEqualTo
in classGenericAssert<BigDecimal>
- Parameters:
expected
- the givenBigDecimal
to compare the actualBigDecimal
to.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualBigDecimal
value is not equal to the given one.- See Also:
-
isNotEqualTo
Verifies that the actual
is not equal to the given one.BigDecimal
- Specified by:
isNotEqualTo
in classGenericAssert<BigDecimal>
- Parameters:
other
- the givenBigDecimal
to compare the actualBigDecimal
to.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualBigDecimal
value is equal to the given one.
-
isEqualByComparingTo
Verifies that the actual
is equal to the given one. TwoBigDecimal
objects that are equal in value but have a different scale (like 2.0 and 2.00) are considered equal by this method.BigDecimal
- Specified by:
isEqualByComparingTo
in classComparableAssert<BigDecimal>
- Parameters:
expected
- the givenBigDecimal
to compare the actualBigDecimal
to.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualBigDecimal
value isnull
.AssertionError
- if the actualBigDecimal
value is not equal to the given one.- See Also:
-
isNotEqualByComparingTo
Verifies that the actual
is not equal to the given one. TwoBigDecimal
objects that are equal in value but have a different scale (like 2.0 and 2.00) are considered equal by this method.BigDecimal
- Specified by:
isNotEqualByComparingTo
in classComparableAssert<BigDecimal>
- Parameters:
expected
- the givenBigDecimal
to use to compare to the actualBigDecimal
.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualBigDecimal
value isnull
.AssertionError
- if the actualBigDecimal
value is equal to the given one.- See Also:
-
isLessThan
Verifies that the actual
value is less than the given one.BigDecimal
- Specified by:
isLessThan
in classComparableAssert<BigDecimal>
- Parameters:
other
- the given value.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualBigDecimal
value isnull
.AssertionError
- if the actualBigDecimal
value is not less than the given one.
-
isGreaterThan
Verifies that the actual
value is greater than the given one.BigDecimal
- Specified by:
isGreaterThan
in classComparableAssert<BigDecimal>
- Parameters:
other
- the given value.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualBigDecimal
value isnull
.AssertionError
- if the actualBigDecimal
value is not greater than the given one.
-
isLessThanOrEqualTo
Verifies that the actual
value is less than or equal to the given one.BigDecimal
- Specified by:
isLessThanOrEqualTo
in classComparableAssert<BigDecimal>
- Parameters:
other
- the given value.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualBigDecimal
value isnull
.AssertionError
- if the actualBigDecimal
value is not less than or equal to the given one.
-
isGreaterThanOrEqualTo
Verifies that the actual
value is greater than or equal to the given one.BigDecimal
- Specified by:
isGreaterThanOrEqualTo
in classComparableAssert<BigDecimal>
- Parameters:
other
- the given value.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualBigDecimal
value isnull
.AssertionError
- if the actualBigDecimal
value is not greater than or equal to the given one.
-
isNotZero
Verifies that the actual
is not equal to zero, regardless of precision. Essentially, this is the same asBigDecimal
(isNotEqualByComparingTo
).BigDecimal.ZERO
- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actualBigDecimal
isnull
.AssertionError
- if the actualBigDecimal
is equal to zero.
-
overridingErrorMessage
Replaces the default message displayed in case of a failure with the given one.For example, the following assertion:
assertThat("Hello").isEqualTo("Bye");
will fail with the default message "expected:<'[Bye]'> but was:<'[Hello]'>."We can replace this message with our own:
assertThat("Hello").overridingErrorMessage("'Hello' should be equal to 'Bye'").isEqualTo("Bye");
in this case, the assertion will fail showing the message "'Hello' should be equal to 'Bye'".- Specified by:
overridingErrorMessage
in classGenericAssert<BigDecimal>
- Parameters:
message
- the given error message, which will replace the default one.- Returns:
- this assertion.
-