|
||||||||||
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.ShortAssert
public class ShortAssert
Understands assertion methods for short
s. To create a new instance of this class use the
method
.
Assertions.assertThat(short)
Constructor Summary | |
---|---|
protected |
ShortAssert(short actual)
Creates a new ShortAssert . |
Method Summary | |
---|---|
ShortAssert |
as(Description description)
Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails. |
ShortAssert |
as(String description)
Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails. |
ShortAssert |
describedAs(Description description)
Alias for , since "as" is a keyword in
Groovy. |
ShortAssert |
describedAs(String description)
Alias for , since "as" is a keyword in
Groovy. |
ShortAssert |
isEqualTo(short expected)
Verifies that the actual short value is equal to the given one. |
ShortAssert |
isGreaterThan(short other)
Verifies that the actual short value is greater than the given one. |
ShortAssert |
isGreaterThanOrEqualTo(short other)
Verifies that the actual short value is greater or equal to the given one. |
ShortAssert |
isLessThan(short other)
Verifies that the actual short value is less than the given one. |
ShortAssert |
isLessThanOrEqualTo(short other)
Verifies that the actual short value is less or equal to the given one. |
ShortAssert |
isNegative()
Verifies that the actual short value is negative. |
ShortAssert |
isNotEqualTo(short other)
Verifies that the actual short value is not equal to the given one. |
ShortAssert |
isPositive()
Verifies that the actual short value is positive. |
ShortAssert |
isZero()
Verifies that the actual short value is equal to zero. |
ShortAssert |
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 ShortAssert(short actual)
ShortAssert
.
actual
- the target to verify.Method Detail |
---|
public ShortAssert 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 PrimitiveAssert
description
- the description of the actual value.
public ShortAssert 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 PrimitiveAssert
description
- the description of the actual value.
public ShortAssert 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 PrimitiveAssert
description
- the description of the actual value.
public ShortAssert 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 PrimitiveAssert
description
- the description of the actual value.
public ShortAssert isEqualTo(short expected)
short
value is equal to the given one.
expected
- the value to compare the actual one to.
AssertionError
- if the actual short
value is not equal to the given one.public ShortAssert isNotEqualTo(short other)
short
value is not equal to the given one.
other
- the given value.
AssertionError
- if the actual short
value is equal to the given one.public ShortAssert isGreaterThan(short other)
short
value is greater than the given one.
other
- the given value.
AssertionError
- if the actual short
value is not greater than the given one.public ShortAssert isLessThan(short other)
short
value is less than the given one.
other
- the given value.
AssertionError
- if the actual short
value is not less than the given one.public ShortAssert isGreaterThanOrEqualTo(short other)
short
value is greater or equal to the given one.
other
- the given value.
AssertionError
- if the actual short
value is not greater than or equal to the given one.public ShortAssert isLessThanOrEqualTo(short other)
short
value is less or equal to the given one.
other
- the given value.
AssertionError
- if the actual short
value is not less than or equal to the given one.public ShortAssert isZero()
short
value is equal to zero.
isZero
in interface NumberAssert
AssertionError
- if the actual short
value is not equal to zero.public ShortAssert isPositive()
short
value is positive.
isPositive
in interface NumberAssert
AssertionError
- if the actual short
value is not positive.public ShortAssert isNegative()
short
value is negative.
isNegative
in interface NumberAssert
AssertionError
- if the actual short
value is not negative.public ShortAssert 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 PrimitiveAssert
message
- 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 |