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