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