|
||||||||||
| 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<Boolean>
org.fest.assertions.BooleanAssert
public class BooleanAssert
Understands assertion methods for Booleans and booleans. To create a new instance of this class call
or Assertions.assertThat(Boolean).
Assertions.assertThat(boolean)
| Field Summary |
|---|
| Fields inherited from class org.fest.assertions.GenericAssert |
|---|
actual |
| Constructor Summary | |
|---|---|
protected |
BooleanAssert(boolean actual)
Creates a new . |
protected |
BooleanAssert(Boolean actual)
Creates a new . |
| Method Summary | |
|---|---|
BooleanAssert |
as(Description description)
Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails. |
BooleanAssert |
as(String description)
Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails. |
BooleanAssert |
describedAs(Description description)
Alias for , since "as" is a keyword in
Groovy. |
BooleanAssert |
describedAs(String description)
Alias for , since "as" is a keyword in
Groovy. |
BooleanAssert |
doesNotSatisfy(Condition<Boolean> condition)
Verifies that the actual Boolean does not satisfy the given condition. |
BooleanAssert |
is(Condition<Boolean> condition)
Alias for . |
BooleanAssert |
isEqualTo(boolean expected)
Verifies that the actual Boolean is equal to the given one. |
BooleanAssert |
isEqualTo(Boolean expected)
Verifies that the actual Boolean value is equal to the given one. |
void |
isFalse()
Verifies that the actual Boolean value is false. |
BooleanAssert |
isNot(Condition<Boolean> condition)
Alias for . |
BooleanAssert |
isNotEqualTo(boolean other)
Verifies that the actual Boolean is not equal to the given one. |
BooleanAssert |
isNotEqualTo(Boolean other)
Verifies that the actual Boolean is not equal to the given one. |
BooleanAssert |
isNotNull()
Verifies that the actual Boolean is not null. |
BooleanAssert |
isNotSameAs(Boolean other)
Verifies that the actual Boolean is not the same object as the given one. |
BooleanAssert |
isSameAs(Boolean expected)
Verifies that the actual Boolean is the same object as the given one. |
void |
isTrue()
Verifies that the actual Boolean value is true. |
BooleanAssert |
overridingErrorMessage(String message)
Replaces the default message displayed in case of a failure with the given one. |
BooleanAssert |
satisfies(Condition<Boolean> condition)
Verifies that the actual Boolean 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 BooleanAssert(boolean actual)
BooleanAssert.
actual - the actual value to verify.protected BooleanAssert(Boolean actual)
BooleanAssert.
actual - the actual value to verify.| Method Detail |
|---|
public BooleanAssert 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<Boolean>description - the description of the actual value.
public BooleanAssert 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<Boolean>description - the description of the actual value.
public BooleanAssert 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<Boolean>description - the description of the actual value.
public BooleanAssert 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<Boolean>description - the description of the actual value.
public void isTrue()
Boolean value is true.
AssertionError - if the actual Boolean value is false.public void isFalse()
Boolean value is false.
AssertionError - if the actual Boolean value is true.public BooleanAssert isEqualTo(boolean expected)
Boolean is equal to the given one.
expected - the given boolean to compare the actual Boolean to.
AssertionError - if the actual Boolean is not equal to the given one.public BooleanAssert isEqualTo(Boolean expected)
Boolean value is equal to the given one.
isEqualTo in class GenericAssert<Boolean>expected - the given Boolean value to compare the actual Boolean to.
AssertionError - if the actual Boolean value is not equal to the given one.public BooleanAssert isNotEqualTo(boolean other)
Boolean is not equal to the given one.
other - the given boolean to compare the actual Boolean to.
AssertionError - if the actual Boolean is equal to the given one.public BooleanAssert isNotEqualTo(Boolean other)
Boolean is not equal to the given one.
isNotEqualTo in class GenericAssert<Boolean>other - the given Boolean to compare the actual Boolean to.
AssertionError - if the actual Boolean value is equal to the given one.public BooleanAssert satisfies(Condition<Boolean> condition)
Boolean satisfies the given condition.
satisfies in class GenericAssert<Boolean>condition - the given condition.
NullPointerException - if the given condition is null.
AssertionError - if the actual Boolean does not satisfy the given condition.is(Condition)public BooleanAssert doesNotSatisfy(Condition<Boolean> condition)
Boolean does not satisfy the given condition.
doesNotSatisfy in class GenericAssert<Boolean>condition - the given condition.
NullPointerException - if the given condition is null.
AssertionError - if the actual value does satisfies the given condition.isNot(Condition)public BooleanAssert is(Condition<Boolean> condition)
satisfies(Condition).
is in class GenericAssert<Boolean>condition - the given condition.
NullPointerException - if the given condition is null.
AssertionError - if the actual Boolean does not satisfy the given condition.public BooleanAssert isNot(Condition<Boolean> condition)
doesNotSatisfy(Condition).
isNot in class GenericAssert<Boolean>condition - the given condition.
NullPointerException - if the given condition is null.
AssertionError - if the actual Boolean does not satisfy the given condition.public BooleanAssert isNotNull()
Boolean is not null.
isNotNull in class GenericAssert<Boolean>AssertionError - if the actual Boolean value is null.public BooleanAssert isSameAs(Boolean expected)
Boolean is the same object as the given one.
isSameAs in class GenericAssert<Boolean>expected - the given Boolean to compare the actual Boolean to.
AssertionError - if the actual Boolean value is not the same as the given one.public BooleanAssert isNotSameAs(Boolean other)
Boolean is not the same object as the given one.
isNotSameAs in class GenericAssert<Boolean>other - the given Boolean to compare the actual Boolean to.
AssertionError - if the actual Boolean value is the same as the given one.public BooleanAssert 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<Boolean>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 | |||||||||