|
||||||||||
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<A> condition)
Verifies that the actual value does not satisfy the given condition. |
boolean |
equals(Object obj)
Throws if called. |
S |
has(Condition<A> condition)
Verifies that the actual value satisfies the given condition. |
int |
hashCode()
Always returns 1. |
S |
is(Condition<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 |
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 |
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 |
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 |
isNotNull()
Verifies that the actual value is not null . |
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 |
isSameAs(A expected)
Verifies that the actual value is the same as the given one. |
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 final 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 final 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 final 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 final 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 final void isNull()
null
.
isNull
in interface Assert<S extends AbstractAssert<S,A>,A>
public final S isNotNull()
null
.
isNotNull
in interface Assert<S extends AbstractAssert<S,A>,A>
this
assertion object.public final 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 final 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 final 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 final 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 final 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 final 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 final S is(Condition<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 final 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 final S has(Condition<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 final S doesNotHave(Condition<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 final String descriptionText()
describedAs(String)
or describedAs(Description)
.
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 Object
public final int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |