|
||||||||||
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<Long>
org.fest.assertions.LongAssert
public class LongAssert
Understands assertion methods for Long
s and long
s. To create a new instance of this class call
or Assertions.assertThat(Long)
.
Assertions.assertThat(long)
Field Summary |
---|
Fields inherited from class org.fest.assertions.GenericAssert |
---|
actual |
Constructor Summary | |
---|---|
protected |
LongAssert(long actual)
Creates a new . |
protected |
LongAssert(Long actual)
Creates a new . |
Method Summary | |
---|---|
LongAssert |
as(Description description)
Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails. |
LongAssert |
as(String description)
Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails. |
LongAssert |
describedAs(Description description)
Alias for , since "as" is a keyword in
Groovy. |
LongAssert |
describedAs(String description)
Alias for , since "as" is a keyword in
Groovy. |
LongAssert |
doesNotSatisfy(Condition<Long> condition)
Verifies that the actual Long does not satisfy the given condition. |
LongAssert |
is(Condition<Long> condition)
Alias for . |
LongAssert |
isEqualTo(long expected)
Verifies that the actual Long is equal to the given one. |
LongAssert |
isEqualTo(Long expected)
Verifies that the actual Long is equal to the given one. |
LongAssert |
isGreaterThan(long other)
Verifies that the actual Long is greater than the given one. |
LongAssert |
isGreaterThanOrEqualTo(long other)
Verifies that the actual Long is greater or equal to the given one. |
LongAssert |
isLessThan(long other)
Verifies that the actual Long is less than the given one. |
LongAssert |
isLessThanOrEqualTo(long other)
Verifies that the actual Long is less or equal to the given one. |
LongAssert |
isNegative()
Verifies that the actual Long is negative. |
LongAssert |
isNot(Condition<Long> condition)
Alias for . |
LongAssert |
isNotEqualTo(long other)
Verifies that the actual Long is not equal to the given one. |
LongAssert |
isNotEqualTo(Long other)
Verifies that the actual Long is not equal to the given one. |
LongAssert |
isNotNull()
Verifies that the actual Long is not null . |
LongAssert |
isNotSameAs(Long other)
Verifies that the actual Long is not the same object as the given one. |
LongAssert |
isPositive()
Verifies that the actual Long is positive. |
LongAssert |
isSameAs(Long expected)
Verifies that the actual Long is the same object as the given one. |
LongAssert |
isZero()
Verifies that the actual Long is equal to zero. |
LongAssert |
overridingErrorMessage(String message)
Replaces the default message displayed in case of a failure with the given one. |
LongAssert |
satisfies(Condition<Long> condition)
Verifies that the actual Long 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 LongAssert(long actual)
LongAssert
.
actual
- the actual value to verify.protected LongAssert(Long actual)
LongAssert
.
actual
- the actual value to verify.Method Detail |
---|
public LongAssert 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<Long>
description
- the description of the actual value.
public LongAssert 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<Long>
description
- the description of the actual value.
public LongAssert 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<Long>
description
- the description of the actual value.
public LongAssert 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<Long>
description
- the description of the actual value.
public LongAssert isEqualTo(long expected)
Long
is equal to the given one.
expected
- the value to compare the actual one to.
AssertionError
- if the actual Long
is not equal to the given one.public LongAssert isEqualTo(Long expected)
Long
is equal to the given one.
isEqualTo
in class GenericAssert<Long>
expected
- the value to compare the actual Long
to.
AssertionError
- if the actual Long
is not equal to the given one.public LongAssert isNotEqualTo(long other)
Long
is not equal to the given one.
other
- the given value.
AssertionError
- if the actual Long
is equal to the given one.public LongAssert isNotEqualTo(Long other)
Long
is not equal to the given one.
isNotEqualTo
in class GenericAssert<Long>
other
- the value to compare the actual Long
to.
AssertionError
- if the actual Long
is equal to the given one.public LongAssert isGreaterThan(long other)
Long
is greater than the given one.
other
- the given value.
AssertionError
- if the actual Long
is not greater than the given one.public LongAssert isLessThan(long other)
Long
is less than the given one.
other
- the given value.
AssertionError
- if the actual Long
is not less than the given one.public LongAssert isGreaterThanOrEqualTo(long other)
Long
is greater or equal to the given one.
other
- the given value.
AssertionError
- if the actual Long
is not greater than or equal to the given one.public LongAssert isLessThanOrEqualTo(long other)
Long
is less or equal to the given one.
other
- the given value.
AssertionError
- if the actual Long
is not less than or equal to the given one.public LongAssert isZero()
Long
is equal to zero.
isZero
in interface NumberAssert
AssertionError
- if the actual Long
is not equal to zero.public LongAssert isPositive()
Long
is positive.
isPositive
in interface NumberAssert
AssertionError
- if the actual Long
is not positive.public LongAssert isNegative()
Long
is negative.
isNegative
in interface NumberAssert
AssertionError
- if the actual Long
is not negative.public LongAssert 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<Long>
message
- the given error message, which will replace the default one.
public LongAssert satisfies(Condition<Long> condition)
Long
satisfies the given condition.
satisfies
in class GenericAssert<Long>
condition
- the given condition.
NullPointerException
- if the given condition is null
.
AssertionError
- if the actual Long
does not satisfy the given condition.is(Condition)
public LongAssert doesNotSatisfy(Condition<Long> condition)
Long
does not satisfy the given condition.
doesNotSatisfy
in class GenericAssert<Long>
condition
- the given condition.
NullPointerException
- if the given condition is null
.
AssertionError
- if the actual value does satisfies the given condition.isNot(Condition)
public LongAssert is(Condition<Long> condition)
satisfies(Condition)
.
is
in class GenericAssert<Long>
condition
- the given condition.
NullPointerException
- if the given condition is null
.
AssertionError
- if the actual Long
does not satisfy the given condition.public LongAssert isNot(Condition<Long> condition)
doesNotSatisfy(Condition)
.
isNot
in class GenericAssert<Long>
condition
- the given condition.
NullPointerException
- if the given condition is null
.
AssertionError
- if the actual Long
does not satisfy the given condition.public LongAssert isNotNull()
Long
is not null
.
isNotNull
in class GenericAssert<Long>
AssertionError
- if the actual Long
is null
.public LongAssert isSameAs(Long expected)
Long
is the same object as the given one.
isSameAs
in class GenericAssert<Long>
expected
- the value to compare the actual Long
to.
AssertionError
- if the actual Long
is not the same as the given one.public LongAssert isNotSameAs(Long other)
Long
is not the same object as the given one.
isNotSameAs
in class GenericAssert<Long>
other
- the value to compare the actual Long
to.
AssertionError
- if the actual Long
is the same as the given one.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |