|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fest.assertions.api.AbstractAssert<S,A>
S - the "self" type of this assertion class. Please read "Emulating
'self types' using Java Generics to simplify fluent API implementation" for more details.A - the type of the "actual" value.public abstract class AbstractAssert<S extends AbstractAssert<S,A>,A>
Base class for all assertions.
| Field Summary | |
|---|---|
protected A |
actual
|
protected S |
myself
|
| Constructor Summary | |
|---|---|
protected |
AbstractAssert(A actual,
Class<?> selfType)
|
| Method Summary | |
|---|---|
S |
as(Description description)
Sets the description of this object. |
S |
as(String description)
Sets the description of this object. |
S |
describedAs(Description description)
Alias for since "as" is a keyword in Groovy. |
S |
describedAs(String description)
Alias for since "as" is a keyword in Groovy. |
String |
descriptionText()
The description of this assertion set with describedAs(String) or describedAs(Description). |
S |
doesNotHave(Condition<? super A> condition)
Verifies that the actual value does not satisfy the given condition. |
S |
doesNotHaveSameClassAs(Object other)
Verifies that the actual value does not have the same class as the given object. |
boolean |
equals(Object obj)
Throws if called. |
S |
has(Condition<? super A> condition)
Verifies that the actual value satisfies the given condition. |
int |
hashCode()
Always returns 1. |
S |
hasSameClassAs(Object other)
Verifies that the actual value has the same class as the given object. |
S |
is(Condition<? super A> condition)
Verifies that the actual value satisfies the given condition. |
S |
isEqualTo(A expected)
Verifies that the actual value is equal to the given one. |
S |
isExactlyInstanceOf(Class<?> type)
Verifies that the actual value is exactly an instance of the given type. |
S |
isIn(A... values)
Verifies that the actual value is present in the given array of values. |
S |
isIn(Iterable<? extends A> values)
Verifies that the actual value is present in the given values. |
S |
isInstanceOf(Class<?> type)
Verifies that the actual value is an instance of the given type. |
S |
isInstanceOfAny(Class<?>... types)
Verifies that the actual value is an instance of any of the given types. |
S |
isNot(Condition<? super A> condition)
Verifies that the actual value does not satisfy the given condition. |
S |
isNotEqualTo(A other)
Verifies that the actual value is not equal to the given one. |
S |
isNotExactlyInstanceOf(Class<?> type)
Verifies that the actual value is not exactly an instance of given type. |
S |
isNotIn(A... values)
Verifies that the actual value is not present in the given array of values. |
S |
isNotIn(Iterable<? extends A> values)
Verifies that the actual value is not present in the given values. |
S |
isNotInstanceOf(Class<?> type)
Verifies that the actual value is not an instance of the given type. |
S |
isNotInstanceOfAny(Class<?>... types)
Verifies that the actual value is not an instance of any of the given types. |
S |
isNotNull()
Verifies that the actual value is not null. |
S |
isNotOfAnyClassIn(Class<?>... types)
Verifies that the actual value type is not in given types. |
S |
isNotSameAs(A other)
Verifies that the actual value is not the same as the given one. |
void |
isNull()
Verifies that the actual value is null. |
S |
isOfAnyClassIn(Class<?>... types)
Verifies that the actual value type is in given types. |
S |
isSameAs(A expected)
Verifies that the actual value is the same as the given one. |
S |
overridingErrorMessage(String newErrorMessage,
Object... args)
Overrides Fest default error message by the given one, the new error message can be built using String.format(String, Object...), hence the presence of args parameter. |
S |
usingComparator(Comparator<? super A> customComparator)
Use given custom comparator instead of relying on actual type A equals method for incoming assertion checks. |
S |
usingDefaultComparator()
Revert to standard comparison for incoming assertion checks. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final A actual
protected final S extends AbstractAssert<S,A> myself
| Constructor Detail |
|---|
protected AbstractAssert(A actual,
Class<?> selfType)
| Method Detail |
|---|
public S as(String description)
as in interface Descriptable<S extends AbstractAssert<S,A>>description - the new description to set.
this object.Descriptable.describedAs(String)public S as(Description description)
EmptyTextDescription as
argument.
This overloaded version of "describedAs" offers more flexibility than the one taking a String by allowing users to
pass their own implementation of a description. For example, a description that creates its value lazily, only when an
assertion failure occurs.
as in interface Descriptable<S extends AbstractAssert<S,A>>description - the new description to set.
this object.Descriptable.describedAs(Description)public S describedAs(String description)
Descriptable.as(String) since "as" is a keyword in Groovy.
describedAs in interface Descriptable<S extends AbstractAssert<S,A>>description - the new description to set.
this object.public S describedAs(Description description)
Descriptable.as(String) since "as" is a keyword in Groovy. To remove or clear the description, pass a EmptyTextDescription as argument.
This overloaded version of "describedAs" offers more flexibility than the one taking a String by allowing users to
pass their own implementation of a description. For example, a description that creates its value lazily, only when an
assertion failure occurs.
describedAs in interface Descriptable<S extends AbstractAssert<S,A>>description - the new description to set.
this object.public S isEqualTo(A expected)
isEqualTo in interface Assert<S extends AbstractAssert<S,A>,A>expected - the given value to compare the actual value to.
this assertion object.public S isNotEqualTo(A other)
isNotEqualTo in interface Assert<S extends AbstractAssert<S,A>,A>other - the given value to compare the actual value to.
this assertion object.public void isNull()
null.
isNull in interface Assert<S extends AbstractAssert<S,A>,A>public S isNotNull()
null.
isNotNull in interface Assert<S extends AbstractAssert<S,A>,A>this assertion object.public S isSameAs(A expected)
isSameAs in interface Assert<S extends AbstractAssert<S,A>,A>expected - the given value to compare the actual value to.
this assertion object.public S isNotSameAs(A other)
isNotSameAs in interface Assert<S extends AbstractAssert<S,A>,A>other - the given value to compare the actual value to.
this assertion object.public S isIn(A... values)
isIn in interface Assert<S extends AbstractAssert<S,A>,A>values - the given array to search the actual value in.
this assertion object.public S isNotIn(A... values)
isNotIn in interface Assert<S extends AbstractAssert<S,A>,A>values - the given array to search the actual value in.
this assertion object.public S isIn(Iterable<? extends A> values)
isIn in interface Assert<S extends AbstractAssert<S,A>,A>values - the given iterable to search the actual value in.
this assertion object.public S isNotIn(Iterable<? extends A> values)
isNotIn in interface Assert<S extends AbstractAssert<S,A>,A>values - the given iterable to search the actual value in.
this assertion object.public S is(Condition<? super A> condition)
ExtensionPoints.has(Condition).
is in interface ExtensionPoints<S extends AbstractAssert<S,A>,A>condition - the given condition.
this ExtensionPoints object.ExtensionPoints.is(Condition)public S isNot(Condition<? super A> condition)
ExtensionPoints.doesNotHave(Condition).
isNot in interface ExtensionPoints<S extends AbstractAssert<S,A>,A>condition - the given condition.
this ExtensionPoints object.ExtensionPoints.isNot(Condition)public S has(Condition<? super A> condition)
ExtensionPoints.is(Condition)
.
has in interface ExtensionPoints<S extends AbstractAssert<S,A>,A>condition - the given condition.
this ExtensionPoints object.ExtensionPoints.is(Condition)public S doesNotHave(Condition<? super A> condition)
ExtensionPoints.isNot(Condition).
doesNotHave in interface ExtensionPoints<S extends AbstractAssert<S,A>,A>condition - the given condition.
this ExtensionPoints object.ExtensionPoints.isNot(Condition)public S isInstanceOf(Class<?> type)
isInstanceOf in interface Assert<S extends AbstractAssert<S,A>,A>type - the type to check the actual value against.
public S isInstanceOfAny(Class<?>... types)
isInstanceOfAny in interface Assert<S extends AbstractAssert<S,A>,A>types - the types to check the actual value against.
public S isNotInstanceOf(Class<?> type)
isNotInstanceOf in interface Assert<S extends AbstractAssert<S,A>,A>type - the type to check the actual value against.
public S isNotInstanceOfAny(Class<?>... types)
isNotInstanceOfAny in interface Assert<S extends AbstractAssert<S,A>,A>types - the types to check the actual value against.
public S hasSameClassAs(Object other)
hasSameClassAs in interface Assert<S extends AbstractAssert<S,A>,A>other - the object to check type against.
public S doesNotHaveSameClassAs(Object other)
doesNotHaveSameClassAs in interface Assert<S extends AbstractAssert<S,A>,A>other - the object to check type against.
public S isExactlyInstanceOf(Class<?> type)
isExactlyInstanceOf in interface Assert<S extends AbstractAssert<S,A>,A>type - the type to check the actual value against.
public S isNotExactlyInstanceOf(Class<?> type)
isNotExactlyInstanceOf in interface Assert<S extends AbstractAssert<S,A>,A>type - the type to check the actual value against.
public S isOfAnyClassIn(Class<?>... types)
isOfAnyClassIn in interface Assert<S extends AbstractAssert<S,A>,A>types - the types to check the actual value against.
public S isNotOfAnyClassIn(Class<?>... types)
isNotOfAnyClassIn in interface Assert<S extends AbstractAssert<S,A>,A>types - the types to check the actual value against.
public String descriptionText()
describedAs(String) or describedAs(Description).
public S overridingErrorMessage(String newErrorMessage,
Object... args)
String.format(String, Object...), hence the presence of args parameter.
Example :
assertThat(player.isRookie()).
overridingErrorMessage("Expecting Player <%s> to be a rookie but was not.", player).
isTrue();
newErrorMessage - the error message that will replace the default one provided by Fest.args - the args used to fill error message as in String.format(String, Object...).
exception - see String.format(String, Object...) exception clause.public S usingComparator(Comparator<? super A> customComparator)
Custom comparator is bound to assertion instance, meaning that if a new assertion is created, it will use default comparison strategy.
Examples :
// frodo and sam are instances of Character with Hobbit race (obviously :). // raceComparator implements Comparator<Character> assertThat(frodo).usingComparator(raceComparator).isEqualTo(sam);
usingComparator in interface Assert<S extends AbstractAssert<S,A>,A>customComparator - the comparator to use for incoming assertion checks.
this assertion object.public S usingDefaultComparator()
This method should be used to disable a custom comparison strategy set by calling Assert.usingComparator(Comparator).
usingDefaultComparator in interface Assert<S extends AbstractAssert<S,A>,A>this assertion object.public final boolean equals(Object obj)
UnsupportedOperationException if called. It is easy to accidentally call
Assert.equals(Object) instead of isEqualTo.
equals in interface Assert<S extends AbstractAssert<S,A>,A>equals in class Objectpublic final int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||