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