|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
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 interface Assert<S,A>
Base contract of all assertion objects: the minimum functionality that any assertion object should provide.
| Method Summary | |
|---|---|
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 |
hasSameClassAs(Object other)
Verifies that the actual value has the same class as the given object. |
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 |
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 |
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 interface org.fest.assertions.core.Descriptable |
|---|
as, as, describedAs, describedAs |
| Methods inherited from interface org.fest.assertions.core.ExtensionPoints |
|---|
doesNotHave, has, is, isNot |
| Method Detail |
|---|
S isEqualTo(A expected)
expected - the given value to compare the actual value to.
this assertion object.
AssertionError - if the actual value is not equal to the given one.S isNotEqualTo(A other)
other - the given value to compare the actual value to.
this assertion object.
AssertionError - if the actual value is equal to the given one.void isNull()
null.
AssertionError - if the actual value is not null.S isNotNull()
null.
this assertion object.
AssertionError - if the actual value is null.S isSameAs(A expected)
expected - the given value to compare the actual value to.
this assertion object.
AssertionError - if the actual value is not the same as the given one.S isNotSameAs(A other)
other - the given value to compare the actual value to.
this assertion object.
AssertionError - if the actual value is the same as the given one.S isIn(A... values)
values - the given array to search the actual value in.
this assertion object.
NullPointerException - if the given array is null.
IllegalArgumentException - if the given array is empty.
AssertionError - if the actual value is not present in the given array.S isNotIn(A... values)
values - the given array to search the actual value in.
this assertion object.
NullPointerException - if the given array is null.
IllegalArgumentException - if the given array is empty.
AssertionError - if the actual value is present in the given array.S isIn(Iterable<? extends A> values)
values - the given iterable to search the actual value in.
this assertion object.
NullPointerException - if the given collection is null.
IllegalArgumentException - if the given collection is empty.
AssertionError - if the actual value is not present in the given collection.S isNotIn(Iterable<? extends A> values)
values - the given iterable to search the actual value in.
this assertion object.
NullPointerException - if the given collection is null.
IllegalArgumentException - if the given collection is empty.
AssertionError - if the actual value is present in the given collection.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);
customComparator - the comparator to use for incoming assertion checks.
this assertion object.
NullPointerException - if the given comparator is null.S usingDefaultComparator()
This method should be used to disable a custom comparison strategy set by calling usingComparator(Comparator).
this assertion object.S isInstanceOf(Class<?> type)
type - the type to check the actual value against.
NullPointerException - if the given type is null.
AssertionError - if the actual value is null.
AssertionError - if the actual value is not an instance of the given type.S isInstanceOfAny(Class<?>... types)
types - the types to check the actual value against.
AssertionError - if the actual value is null.
AssertionError - if the actual value is not an instance of any of the given types.
NullPointerException - if the given array of types is null.
NullPointerException - if the given array of types contains nulls.S isNotInstanceOf(Class<?> type)
type - the type to check the actual value against.
NullPointerException - if the given type is null.
AssertionError - if the actual value is null.
AssertionError - if the actual value is an instance of the given type.S isNotInstanceOfAny(Class<?>... types)
types - the types to check the actual value against.
AssertionError - if the actual value is null.
AssertionError - if the actual value is an instance of any of the given types.
NullPointerException - if the given array of types is null.
NullPointerException - if the given array of types contains nulls.S hasSameClassAs(Object other)
other - the object to check type against.
AssertionError - if the actual has not the same type has the given object.
NullPointerException - if the actual value is null.
NullPointerException - if the given object is null.S doesNotHaveSameClassAs(Object other)
other - the object to check type against.
AssertionError - if the actual has the same type has the given object.
NullPointerException - if the actual value is null.
NullPointerException - if the given object is null.S isExactlyInstanceOf(Class<?> type)
type - the type to check the actual value against.
AssertionError - if the actual is not exactly an instance of given type.
NullPointerException - if the actual value is null.
NullPointerException - if the given object is null.S isNotExactlyInstanceOf(Class<?> type)
type - the type to check the actual value against.
AssertionError - if the actual is exactly a instance of given type.
NullPointerException - if the actual value is null.
NullPointerException - if the given object is null.S isOfAnyClassIn(Class<?>... types)
types - the types to check the actual value against.
AssertionError - if the actual value type is not in given type.
NullPointerException - if the actual value is null.
NullPointerException - if the given types is null.S isNotOfAnyClassIn(Class<?>... types)
types - the types to check the actual value against.
AssertionError - if the actual value type is in given types.
NullPointerException - if the actual value is null.
NullPointerException - if the given types is null.boolean equals(Object obj)
UnsupportedOperationException if called. It is easy to accidentally call
equals(Object) instead of isEqualTo.
equals in class ObjectUnsupportedOperationException - if this method is called.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||