|
||||||||||
| 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<Double>
org.fest.assertions.DoubleAssert
public class DoubleAssert
Understands Assertion methods for Doubles and doubles. To create a new instance of this class call
or Assertions.assertThat(Double).
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. |
| Field Summary |
|---|
| Fields inherited from class org.fest.assertions.GenericAssert |
|---|
actual |
| Constructor Summary | |
|---|---|
protected |
DoubleAssert(double actual)
Creates a new . |
protected |
DoubleAssert(Double actual)
Creates a new . |
| 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 |
doesNotSatisfy(Condition<Double> condition)
Verifies that the actual Double does not satisfy the given condition. |
DoubleAssert |
is(Condition<Double> condition)
Alias for . |
DoubleAssert |
isEqualTo(double expected)
Verifies that the actual Double is equal to the given one. |
DoubleAssert |
isEqualTo(Double expected)
Verifies that the actual Double is equal to the given one. |
DoubleAssert |
isEqualTo(double expected,
Delta delta)
Verifies that the actual Double is equal to the given one, within a positive delta. |
DoubleAssert |
isEqualTo(Double expected,
Delta delta)
Verifies that the actual Double 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 is greater than the given one. |
DoubleAssert |
isGreaterThanOrEqualTo(double other)
Verifies that the actual Double is greater or equal to the given one. |
DoubleAssert |
isLessThan(double other)
Verifies that the actual Double is less than the given one. |
DoubleAssert |
isLessThanOrEqualTo(double other)
Verifies that the actual Double is less or equal to the given one. |
DoubleAssert |
isNaN()
Verifies that the actual Double is equal to . |
DoubleAssert |
isNegative()
Verifies that the actual Double is negative. |
DoubleAssert |
isNot(Condition<Double> condition)
Alias for . |
DoubleAssert |
isNotEqualTo(double other)
Verifies that the actual Double is not equal to the given one. |
DoubleAssert |
isNotEqualTo(Double other)
Verifies that the actual Double is not equal to the given one. |
DoubleAssert |
isNotNull()
Verifies that the actual Double is not null. |
DoubleAssert |
isNotSameAs(Double other)
Verifies that the actual Double is not the same object as the given one. |
DoubleAssert |
isPositive()
Verifies that the actual Double is positive. |
DoubleAssert |
isSameAs(Double expected)
Verifies that the actual Double is the same object as the given one. |
DoubleAssert |
isZero()
Verifies that the actual Double is equal to zero. |
DoubleAssert |
overridingErrorMessage(String message)
Replaces the default message displayed in case of a failure with the given one. |
DoubleAssert |
satisfies(Condition<Double> condition)
Verifies that the actual Double satisfies the given condition. |
| 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 DoubleAssert(double actual)
DoubleAssert.
actual - the actual value to verify.protected DoubleAssert(Double actual)
DoubleAssert.
actual - the actual value 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(val).as("name").isEqualTo("Frodo");
as in class GenericAssert<Double>description - the description of the actual value.
public DoubleAssert 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<Double>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(val).as(new BasicDescription("name")).isEqualTo("Frodo");
as in class GenericAssert<Double>description - the description of the actual value.
public DoubleAssert 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<Double>description - the description of the actual value.
public DoubleAssert isEqualTo(double expected)
Double is equal to the given one.
expected - the value to compare the actual one to.
AssertionError - if the actual Double is not equal to the given one.public DoubleAssert isEqualTo(Double expected)
Double is equal to the given one.
isEqualTo in class GenericAssert<Double>expected - the given value to compare the actual Double to.
AssertionError - if the actual Double is not equal to the given one.
@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 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 is not equal to the given one.
public DoubleAssert isEqualTo(double expected,
Delta delta)
Double 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 is not equal to the given one.
public DoubleAssert isEqualTo(Double expected,
Delta delta)
Double 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 is not equal to the given one.public DoubleAssert isNotEqualTo(double other)
Double is not equal to the given one.
other - the given value.
AssertionError - if the actual Double is equal to the given one.public DoubleAssert isGreaterThan(double other)
Double is greater than the given one.
other - the given value.
AssertionError - if the actual Double is not greater than the given one.public DoubleAssert isLessThan(double other)
Double is less than the given one.
other - the given value.
AssertionError - if the actual Double is not less than the given one.public DoubleAssert isGreaterThanOrEqualTo(double other)
Double is greater or equal to the given one.
other - the given value.
AssertionError - if the actual Double is not greater than or equal to the given one.public DoubleAssert isLessThanOrEqualTo(double other)
Double is less or equal to the given one.
other - the given value.
AssertionError - if the actual Double is not less than or equal to the given one.public DoubleAssert isZero()
Double is equal to zero.
isZero in interface NumberAssertAssertionError - if the actual Double is not equal to zero.public DoubleAssert isPositive()
Double is positive.
isPositive in interface NumberAssertAssertionError - if the actual Double is not positive.public DoubleAssert isNegative()
Double is negative.
isNegative in interface NumberAssertAssertionError - if the actual Double is not negative.public DoubleAssert isNaN()
Double is equal to Double.NaN.
AssertionError - if the actual Double is not equal to NAN.@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 GenericAssert<Double>message - the given error message, which will replace the default one.
public DoubleAssert satisfies(Condition<Double> condition)
Double satisfies the given condition.
satisfies in class GenericAssert<Double>condition - the given condition.
NullPointerException - if the given condition is null.
AssertionError - if the actual Double does not satisfy the given condition.is(Condition)public DoubleAssert doesNotSatisfy(Condition<Double> condition)
Double does not satisfy the given condition.
doesNotSatisfy in class GenericAssert<Double>condition - the given condition.
NullPointerException - if the given condition is null.
AssertionError - if the actual value does satisfies the given condition.isNot(Condition)public DoubleAssert is(Condition<Double> condition)
satisfies(Condition).
is in class GenericAssert<Double>condition - the given condition.
NullPointerException - if the given condition is null.
AssertionError - if the actual Double does not satisfy the given condition.public DoubleAssert isNot(Condition<Double> condition)
doesNotSatisfy(Condition).
isNot in class GenericAssert<Double>condition - the given condition.
NullPointerException - if the given condition is null.
AssertionError - if the actual Double does not satisfy the given condition.public DoubleAssert isNotEqualTo(Double other)
Double is not equal to the given one.
isNotEqualTo in class GenericAssert<Double>other - the given Double to compare the actual Double to.
AssertionError - if the actual Double is equal to the given one.public DoubleAssert isNotNull()
Double is not null.
isNotNull in class GenericAssert<Double>AssertionError - if the actual Double is null.public DoubleAssert isSameAs(Double expected)
Double is the same object as the given one.
isSameAs in class GenericAssert<Double>expected - the given Double to compare the actual Double to.
AssertionError - if the actual Double is not the same as the given one.public DoubleAssert isNotSameAs(Double other)
Double is not the same object as the given one.
isNotSameAs in class GenericAssert<Double>other - the given Double to compare the actual BigDecimal to.
AssertionError - if the actual Double is the same as the given one.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||