|
||||||||||
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.PrimitiveAssert
org.fest.assertions.DoubleAssert
public class DoubleAssert
Understands Assertion methods for Double
. To create a new instance of this class use the
method
.
Assertions.assertThat(double)
Nested Class Summary | |
---|---|
static class |
DoubleAssert.Delta
Deprecated. use top-level class instead. This class will be removed
in version 2.0. |
Constructor Summary | |
---|---|
protected |
DoubleAssert(double actual)
Creates a new DoubleAssert . |
Method Summary | |
---|---|
DoubleAssert |
as(Description description)
Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails. |
DoubleAssert |
as(String description)
Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails. |
static DoubleAssert.Delta |
delta(double d)
Deprecated. use method instead. This method will be
removed in version 2.0. |
DoubleAssert |
describedAs(Description description)
Alias for , since "as" is a keyword in
Groovy. |
DoubleAssert |
describedAs(String description)
Alias for , since "as" is a keyword in
Groovy. |
DoubleAssert |
isEqualTo(double expected)
Verifies that the actual double value is equal to the given one. |
DoubleAssert |
isEqualTo(double expected,
Delta delta)
Verifies that the actual double value is equal to the given one, within a positive delta. |
DoubleAssert |
isEqualTo(double expected,
DoubleAssert.Delta delta)
Deprecated. use method instead. This method will
be removed in version 2.0. |
DoubleAssert |
isGreaterThan(double other)
Verifies that the actual double value is greater than the given one. |
DoubleAssert |
isGreaterThanOrEqualTo(double other)
Verifies that the actual double value is greater or equal to the given one. |
DoubleAssert |
isLessThan(double other)
Verifies that the actual double value is less than the given one. |
DoubleAssert |
isLessThanOrEqualTo(double other)
Verifies that the actual double value is less or equal to the given one. |
DoubleAssert |
isNaN()
Verifies that the actual double value is equal to . |
DoubleAssert |
isNegative()
Verifies that the actual double value is negative. |
DoubleAssert |
isNotEqualTo(double other)
Verifies that the actual double value is not equal to the given one. |
DoubleAssert |
isPositive()
Verifies that the actual double value is positive. |
DoubleAssert |
isZero()
Verifies that the actual double value is equal to zero. |
DoubleAssert |
overridingErrorMessage(String message)
Replaces the default message displayed in case of a failure with the given one. |
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 DoubleAssert(double actual)
DoubleAssert
.
actual
- the target to verify.Method Detail |
---|
public DoubleAssert 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(value).as("Some value").isEqualTo(otherValue);
as
in class PrimitiveAssert
description
- the description of the actual value.
public DoubleAssert describedAs(String description)
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(value).describedAs("Some value").isEqualTo(otherValue);
describedAs
in class PrimitiveAssert
description
- the description of the actual value.
public DoubleAssert 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(value).as(new BasicDescription("Some value")).isEqualTo(otherValue);
as
in class PrimitiveAssert
description
- the description of the actual value.
public DoubleAssert describedAs(Description description)
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(value).describedAs(new BasicDescription("Some value")).isEqualTo(otherValue);
describedAs
in class PrimitiveAssert
description
- the description of the actual value.
public DoubleAssert isEqualTo(double expected)
double
value is equal to the given one.
expected
- the value to compare the actual one to.
AssertionError
- if the actual double
value is not equal to the given one.public DoubleAssert isNotEqualTo(double other)
double
value is not equal to the given one.
other
- the given value.
AssertionError
- if the actual double
value is equal to the given one.public DoubleAssert isGreaterThan(double other)
double
value is greater than the given one.
other
- the given value.
AssertionError
- if the actual double
value is not greater than the given one.public DoubleAssert isLessThan(double other)
double
value is less than the given one.
other
- the given value.
AssertionError
- if the actual double
value is not less than the given one.public DoubleAssert isGreaterThanOrEqualTo(double other)
double
value is greater or equal to the given one.
other
- the given value.
AssertionError
- if the actual double
value is not greater than or equal to the given one.public DoubleAssert isLessThanOrEqualTo(double other)
double
value is less or equal to the given one.
other
- the given value.
AssertionError
- if the actual double
value is not less than or equal to the given one.public DoubleAssert isZero()
double
value is equal to zero.
isZero
in interface NumberAssert
AssertionError
- if the actual double
value is not equal to zero.public DoubleAssert isPositive()
double
value is positive.
isPositive
in interface NumberAssert
AssertionError
- if the actual double
value is not positive.public DoubleAssert isNegative()
double
value is negative.
isNegative
in interface NumberAssert
AssertionError
- if the actual double
value is not negative.public DoubleAssert isNaN()
double
value is equal to Double.NaN
.
AssertionError
- if the actual double
value is not equal to NAN
.@Deprecated public DoubleAssert isEqualTo(double expected, DoubleAssert.Delta delta)
isEqualTo(double, org.fest.assertions.Delta)
instead. This method will
be removed in version 2.0.
double
value is equal to the given one, within a positive delta.
expected
- the value to compare the actual one to.delta
- the given delta.
AssertionError
- if the actual double
value is not equal to the given one.public DoubleAssert isEqualTo(double expected, Delta delta)
double
value is equal to the given one, within a positive delta.
expected
- the value to compare the actual one to.delta
- the given delta.
AssertionError
- if the actual double
value is not equal to the given one.@Deprecated public static DoubleAssert.Delta delta(double d)
Delta.delta(double)
instead. This method will be
removed in version 2.0.
isEqualTo(double, org.fest.assertions.DoubleAssert.Delta)
.
d
- the delta value.
public DoubleAssert 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 PrimitiveAssert
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 |