|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fest.assertions.Assert
org.fest.assertions.GenericAssert<T>
org.fest.assertions.ComparableAssert<BigDecimal>
org.fest.assertions.BigDecimalAssert
public class BigDecimalAssert
Understands assertion methods for
. To create a new instance of this class use the
method BigDecimal
.
Assertions.assertThat(BigDecimal)
Field Summary |
---|
Fields inherited from class org.fest.assertions.GenericAssert |
---|
actual |
Constructor Summary | |
---|---|
protected |
BigDecimalAssert(BigDecimal actual)
Creates a new BigDecimalAssert . |
Method Summary | |
---|---|
BigDecimalAssert |
as(Description description)
Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails. |
BigDecimalAssert |
as(String description)
Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails. |
BigDecimalAssert |
describedAs(Description description)
Alias for , since "as" is a keyword in
Groovy. |
BigDecimalAssert |
describedAs(String description)
Alias for , since "as" is a keyword in
Groovy. |
BigDecimalAssert |
doesNotSatisfy(Condition<BigDecimal> condition)
Verifies that the actual does not satisfy the given condition. |
BigDecimalAssert |
is(Condition<BigDecimal> condition)
Alias for . |
BigDecimalAssert |
isEqualByComparingTo(BigDecimal expected)
Verifies that the actual is equal to the given one. |
BigDecimalAssert |
isEqualTo(BigDecimal expected)
Verifies that the actual is equal to the given one. |
BigDecimalAssert |
isGreaterThan(BigDecimal other)
Verifies that the actual value is greater than the given one. |
BigDecimalAssert |
isGreaterThanOrEqualTo(BigDecimal other)
Verifies that the actual value is greater than or equal to the given one. |
BigDecimalAssert |
isLessThan(BigDecimal other)
Verifies that the actual value is less than the given one. |
BigDecimalAssert |
isLessThanOrEqualTo(BigDecimal other)
Verifies that the actual value is less than or equal to the given one. |
BigDecimalAssert |
isNegative()
Verifies that the actual is negative. |
BigDecimalAssert |
isNot(Condition<BigDecimal> condition)
Alias for . |
BigDecimalAssert |
isNotEqualByComparingTo(BigDecimal expected)
Verifies that the actual is not equal to the given one. |
BigDecimalAssert |
isNotEqualTo(BigDecimal other)
Verifies that the actual is not equal to the given one. |
BigDecimalAssert |
isNotNull()
Verifies that the actual is not null . |
BigDecimalAssert |
isNotSameAs(BigDecimal other)
Verifies that the actual is not the same as the given one. |
BigDecimalAssert |
isPositive()
Verifies that the actual is positive. |
BigDecimalAssert |
isSameAs(BigDecimal expected)
Verifies that the actual is the same as the given one. |
BigDecimalAssert |
isZero()
Verifies that the actual is equal to zero, regardless of precision. |
BigDecimalAssert |
overridingErrorMessage(String message)
Replaces the default message displayed in case of a failure with the given one. |
BigDecimalAssert |
satisfies(Condition<BigDecimal> condition)
Verifies that the actual satisfies the given condition. |
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 |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected BigDecimalAssert(BigDecimal actual)
BigDecimalAssert
.
actual
- the target to verify.Method Detail |
---|
public BigDecimalAssert as(String description)
AssertionError
thrown when an assertion fails. This method should be called before any assertion method, otherwise any assertion
failure will not show the provided description.
For example:
assertThat(val).as("name").isEqualTo("Frodo");
as
in class GenericAssert<BigDecimal>
description
- the description of the actual value.
public BigDecimalAssert describedAs(String description)
GenericAssert.as(String)
, 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.
For example:
assertThat(val).describedAs("name").isEqualTo("Frodo");
describedAs
in class GenericAssert<BigDecimal>
description
- the description of the actual value.
public BigDecimalAssert as(Description description)
AssertionError
thrown when an assertion fails. This method should be called before any assertion method, otherwise any assertion
failure will not show the provided description.
For example:
assertThat(val).as(new BasicDescription("name")).isEqualTo("Frodo");
as
in class GenericAssert<BigDecimal>
description
- the description of the actual value.
public BigDecimalAssert describedAs(Description description)
GenericAssert.as(Description)
, 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.
For example:
assertThat(val).describedAs(new BasicDescription("name")).isEqualTo("Frodo");
describedAs
in class GenericAssert<BigDecimal>
description
- the description of the actual value.
public BigDecimalAssert satisfies(Condition<BigDecimal> condition)
BigDecimal
satisfies the given condition.
satisfies
in class GenericAssert<BigDecimal>
condition
- the given condition.
NullPointerException
- if the given condition is null
.
AssertionError
- if the actual BigDecimal
does not satisfy the given condition.is(Condition)
public BigDecimalAssert doesNotSatisfy(Condition<BigDecimal> condition)
BigDecimal
does not satisfy the given condition.
doesNotSatisfy
in class GenericAssert<BigDecimal>
condition
- the given condition.
NullPointerException
- if the given condition is null
.
AssertionError
- if the actual value does satisfies the given condition.isNot(Condition)
public BigDecimalAssert is(Condition<BigDecimal> condition)
satisfies(Condition)
.
is
in class GenericAssert<BigDecimal>
condition
- the given condition.
NullPointerException
- if the given condition is null
.
AssertionError
- if the actual BigDecimal
does not satisfy the given condition.public BigDecimalAssert isNot(Condition<BigDecimal> condition)
doesNotSatisfy(Condition)
.
isNot
in class GenericAssert<BigDecimal>
condition
- the given condition.
NullPointerException
- if the given condition is null
.
AssertionError
- if the actual value does satisfies the given condition.public BigDecimalAssert isPositive()
BigDecimal
is positive.
isPositive
in interface NumberAssert
AssertionError
- if the actual BigDecimal
value is null
.
AssertionError
- if the actual BigDecimal
value is not positive.public BigDecimalAssert isNegative()
BigDecimal
is negative.
isNegative
in interface NumberAssert
AssertionError
- if the actual BigDecimal
value is null
.
AssertionError
- if the actual BigDecimal
value is not negative.public BigDecimalAssert isZero()
BigDecimal
is equal to zero, regardless of precision.
Essentially, this is the same as
isEqualByComparingTo
(BigDecimal.ZERO
).
isZero
in interface NumberAssert
AssertionError
- if the actual BigDecimal
value is null
.
AssertionError
- if the actual BigDecimal
value is not equal to zero.public BigDecimalAssert isNotNull()
BigDecimal
is not null
.
isNotNull
in class GenericAssert<BigDecimal>
AssertionError
- if the actual BigDecimal
value is null
.public BigDecimalAssert isSameAs(BigDecimal expected)
BigDecimal
is the same as the given one.
isSameAs
in class GenericAssert<BigDecimal>
expected
- the given BigDecimal
to compare the actual BigDecimal
to.
AssertionError
- if the actual BigDecimal
value is not the same as the given one.public BigDecimalAssert isNotSameAs(BigDecimal other)
BigDecimal
is not the same as the given one.
isNotSameAs
in class GenericAssert<BigDecimal>
other
- the given BigDecimal
to compare the actual BigDecimal
to.
AssertionError
- if the actual BigDecimal
value is the same as the given one.public BigDecimalAssert isEqualTo(BigDecimal expected)
BigDecimal
is equal to the given one. Unlike
isEqualByComparingTo(BigDecimal)
, this method considers two
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).
isEqualTo
in class GenericAssert<BigDecimal>
expected
- the given BigDecimal
to compare the actual BigDecimal
to.
AssertionError
- if the actual BigDecimal
value is not equal to the given one.BigDecimal.equals(Object)
,
isEqualByComparingTo(BigDecimal)
public BigDecimalAssert isNotEqualTo(BigDecimal other)
BigDecimal
is not equal to the given one.
isNotEqualTo
in class GenericAssert<BigDecimal>
other
- the given BigDecimal
to compare the actual BigDecimal
to.
AssertionError
- if the actual BigDecimal
value is equal to the given one.public BigDecimalAssert isEqualByComparingTo(BigDecimal expected)
BigDecimal
is equal to the given one. Two
BigDecimal
objects that are equal in value but have a different scale (like 2.0 and 2.00)
are considered equal by this method.
isEqualByComparingTo
in class ComparableAssert<BigDecimal>
expected
- the given BigDecimal
to compare the actual BigDecimal
to.
AssertionError
- if the actual BigDecimal
value is null
.
AssertionError
- if the actual BigDecimal
value is not equal to the given one.BigDecimal.compareTo(BigDecimal)
public BigDecimalAssert isNotEqualByComparingTo(BigDecimal expected)
BigDecimal
is not equal to the given one. Two
BigDecimal
objects that are equal in value but have a different scale (like 2.0 and 2.00)
are considered equal by this method.
isNotEqualByComparingTo
in class ComparableAssert<BigDecimal>
expected
- the given BigDecimal
to use to compare to the actual BigDecimal
.
AssertionError
- if the actual BigDecimal
value is null
.
AssertionError
- if the actual BigDecimal
value is equal to the given one.BigDecimal.compareTo(BigDecimal)
public BigDecimalAssert isLessThan(BigDecimal other)
BigDecimal
value is less than the given one.
isLessThan
in class ComparableAssert<BigDecimal>
other
- the given value.
AssertionError
- if the actual BigDecimal
value is null
.
AssertionError
- if the actual BigDecimal
value is not less than the given one.public BigDecimalAssert isGreaterThan(BigDecimal other)
BigDecimal
value is greater than the given one.
isGreaterThan
in class ComparableAssert<BigDecimal>
other
- the given value.
AssertionError
- if the actual BigDecimal
value is null
.
AssertionError
- if the actual BigDecimal
value is not greater than the given one.public BigDecimalAssert isLessThanOrEqualTo(BigDecimal other)
BigDecimal
value is less than or equal to the given one.
isLessThanOrEqualTo
in class ComparableAssert<BigDecimal>
other
- the given value.
AssertionError
- if the actual BigDecimal
value is null
.
AssertionError
- if the actual BigDecimal
value is not less than or equal to the given one.public BigDecimalAssert isGreaterThanOrEqualTo(BigDecimal other)
BigDecimal
value is greater than or equal to the given one.
isGreaterThanOrEqualTo
in class ComparableAssert<BigDecimal>
other
- the given value.
AssertionError
- if the actual BigDecimal
value is null
.
AssertionError
- if the actual BigDecimal
value is not greater than or equal to the given one.public BigDecimalAssert overridingErrorMessage(String message)
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'".
overridingErrorMessage
in class GenericAssert<BigDecimal>
message
- the given error message, which will replace the default one.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |