|
||||||||||
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>
org.fest.assertions.api.AbstractIterableAssert<S,A,T>
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.T
- the type of elements of the "actual" value.public abstract class AbstractIterableAssert<S extends AbstractIterableAssert<S,A,T>,A extends Iterable<T>,T>
Base class for implementations of
whose actual value type is
ObjectEnumerableAssert
.
Collection
Field Summary |
---|
Fields inherited from class org.fest.assertions.api.AbstractAssert |
---|
actual, myself |
Constructor Summary | |
---|---|
protected |
AbstractIterableAssert(A actual,
Class<?> selfType)
|
Method Summary | |
---|---|
S |
are(Condition<? super T> condition)
Verifies that each element value satisfies the given condition |
S |
areAtLeast(int times,
Condition<? super T> condition)
Verifies that there is at least n elements in the actual group satisfying the given condition. |
S |
areAtMost(int times,
Condition<? super T> condition)
Verifies that there is at most n elements in the actual group satisfying the given condition. |
S |
areExactly(int times,
Condition<? super T> condition)
Verifies that there is exactly n elements in the actual group satisfying the given condition. |
S |
areNot(Condition<? super T> condition)
Verifies that each element value not satisfies the given condition |
S |
areNotAtLeast(int times,
Condition<? super T> condition)
Verifies that there is at least n elements in the actual group not satisfying the given condition. |
S |
areNotAtMost(int times,
Condition<? super T> condition)
Verifies that there is at most n elements in the actual group not satisfying the given condition. |
S |
areNotExactly(int times,
Condition<? super T> condition)
Verifies that there is exactly n elements in the actual group not satisfying the given condition. |
S |
contains(T... values)
Verifies that the actual group contains the given values, in any order. |
S |
containsAll(Iterable<? extends T> iterable)
Verifies that the actual group contains all the elements of given Iterable , in any order. |
S |
containsExactly(T... values)
Verifies that the actual group contains only the given values and nothing else, in order. |
S |
containsNull()
Verifies that the actual group contains at least a null element. |
S |
containsOnly(T... values)
Verifies that the actual group contains only the given values and nothing else, in any order. |
S |
containsSequence(T... sequence)
Verifies that the actual group contains the given sequence, without any other values between them. |
S |
doesNotContain(T... values)
Verifies that the actual group does not contain the given values. |
S |
doesNotContainNull()
Verifies that the actual group does not contain null elements. |
S |
doesNotHaveDuplicates()
Verifies that the actual group does not contain duplicates. |
S |
doNotHave(Condition<? super T> condition)
Verifies that each element value not satisfies the given condition |
S |
doNotHaveAtLeast(int times,
Condition<? super T> condition)
This method is an alias ObjectEnumerableAssert.areNotAtLeast(int, Condition) . |
S |
doNotHaveAtMost(int times,
Condition<? super T> condition)
This method is an alias ObjectEnumerableAssert.areNotAtMost(int, Condition) . |
S |
doNotHaveExactly(int times,
Condition<? super T> condition)
This method is an alias ObjectEnumerableAssert.areNotExactly(int, Condition) . |
S |
endsWith(T... sequence)
Verifies that the actual group ends with the given sequence of objects, without any other objects between them. |
S |
hasSameSizeAs(Iterable<?> other)
Verifies that the actual group has the same size as given Iterable . |
S |
hasSameSizeAs(Object[] other)
Verifies that the actual group has the same size as given array. |
S |
hasSize(int expected)
Verifies that the number of values in the actual group is equal to the given one. |
S |
have(Condition<? super T> condition)
Verifies that each element value satisfies the given condition |
S |
haveAtLeast(int times,
Condition<? super T> condition)
This method is an alias for ObjectEnumerableAssert.areAtLeast(int, Condition) . |
S |
haveAtMost(int times,
Condition<? super T> condition)
This method is an alias ObjectEnumerableAssert.areAtMost(int, Condition) . |
S |
haveExactly(int times,
Condition<? super T> condition)
This method is an alias ObjectEnumerableAssert.areExactly(int, Condition) . |
void |
isEmpty()
Verifies that the actual group of values is empty. |
S |
isNotEmpty()
Verifies that the actual group of values is not empty. |
void |
isNullOrEmpty()
Verifies that the actual group of values is null or empty. |
S |
isSubsetOf(Iterable<? extends T> values)
Verifies that all the elements of the actual Iterable are present in the given Iterable . |
S |
startsWith(T... sequence)
Verifies that the actual group starts with the given sequence of objects, without any other objects between them. |
S |
usingDefaultElementComparator()
Revert to standard comparison for incoming assertion group element checks. |
S |
usingElementComparator(Comparator<? super T> customComparator)
Use given custom comparator instead of relying on actual type A equals method to compare group
elements for incoming assertion checks. |
Methods inherited from class org.fest.assertions.api.AbstractAssert |
---|
as, as, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, has, hashCode, hasSameClassAs, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, usingComparator, usingDefaultComparator |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractIterableAssert(A actual, Class<?> selfType)
Method Detail |
---|
public void isNullOrEmpty()
null
or empty.
isNullOrEmpty
in interface EnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
public void isEmpty()
isEmpty
in interface EnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
public S isNotEmpty()
isNotEmpty
in interface EnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
this
assertion object.public S hasSize(int expected)
hasSize
in interface EnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
expected
- the expected number of values in the actual group.
this
assertion object.public S hasSameSizeAs(Object[] other)
hasSameSizeAs
in interface EnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
other
- the array to compare size with actual group.
this
assertion object.public S hasSameSizeAs(Iterable<?> other)
Iterable
.
hasSameSizeAs
in interface EnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
other
- the Iterable
to compare size with actual group.
this
assertion object.public S contains(T... values)
contains
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
values
- the given values.
this
assertion object.public S containsOnly(T... values)
containsOnly
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
values
- the given values.
this
assertion object.public S containsExactly(T... values)
containsExactly
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
values
- the given values.
this
assertion object.public S isSubsetOf(Iterable<? extends T> values)
Iterable
are present in the given Iterable
.
values
- the Iterable
that should contain all actual elements.
AssertionError
- if the actual Iterable
is null
.
NullPointerException
- if the given Iterable
is null
.
AssertionError
- if the actual Iterable
is not subset of set Iterable
.public S containsSequence(T... sequence)
containsSequence
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
sequence
- the sequence of objects to look for.
public S doesNotContain(T... values)
doesNotContain
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
values
- the given values.
this
assertion object.public S doesNotHaveDuplicates()
doesNotHaveDuplicates
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
this
assertion object.public S startsWith(T... sequence)
ObjectEnumerableAssert.containsSequence(Object...)
, but it also verifies that the first element in the
sequence is also first element of the actual group.
startsWith
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
sequence
- the sequence of objects to look for.
public S endsWith(T... sequence)
ObjectEnumerableAssert.containsSequence(Object...)
, but it also verifies that the last element in the
sequence is also last element of the actual group.
endsWith
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
sequence
- the sequence of objects to look for.
public S containsNull()
containsNull
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
this
assertion object.public S doesNotContainNull()
doesNotContainNull
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
this
assertion object.public S are(Condition<? super T> condition)
are
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
condition
- the given condition.
this
object.public S areNot(Condition<? super T> condition)
areNot
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
condition
- the given condition.
this
object.public S have(Condition<? super T> condition)
have
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
condition
- the given condition.
this
object.public S doNotHave(Condition<? super T> condition)
doNotHave
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
condition
- the given condition.
this
object.public S areAtLeast(int times, Condition<? super T> condition)
areAtLeast
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
times
- the minimum number of times the condition should be verified.condition
- the given condition.
this
object.public S areNotAtLeast(int times, Condition<? super T> condition)
areNotAtLeast
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
times
- the number of times the condition should not be verified at least.condition
- the given condition.
this
object.public S areAtMost(int times, Condition<? super T> condition)
areAtMost
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
times
- the number of times the condition should be at most verified.condition
- the given condition.
this
object.public S areNotAtMost(int times, Condition<? super T> condition)
areNotAtMost
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
times
- the number of times the condition should not be verified at most.condition
- the given condition.
this
object.public S areExactly(int times, Condition<? super T> condition)
areExactly
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
times
- the exact number of times the condition should be verified.condition
- the given condition.
this
object.public S areNotExactly(int times, Condition<? super T> condition)
areNotExactly
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
times
- the exact number of times the condition should not be verified.condition
- the given condition.
this
object.public S haveAtLeast(int times, Condition<? super T> condition)
ObjectEnumerableAssert.areAtLeast(int, Condition)
.
haveAtLeast
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
public S doNotHaveAtLeast(int times, Condition<? super T> condition)
ObjectEnumerableAssert.areNotAtLeast(int, Condition)
.
doNotHaveAtLeast
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
public S haveAtMost(int times, Condition<? super T> condition)
ObjectEnumerableAssert.areAtMost(int, Condition)
.
haveAtMost
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
public S doNotHaveAtMost(int times, Condition<? super T> condition)
ObjectEnumerableAssert.areNotAtMost(int, Condition)
.
doNotHaveAtMost
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
public S haveExactly(int times, Condition<? super T> condition)
ObjectEnumerableAssert.areExactly(int, Condition)
.
haveExactly
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
public S doNotHaveExactly(int times, Condition<? super T> condition)
ObjectEnumerableAssert.areNotExactly(int, Condition)
.
doNotHaveExactly
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
public S containsAll(Iterable<? extends T> iterable)
Iterable
, in any order.
containsAll
in interface ObjectEnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
iterable
- the given Iterable
we will get elements from.
this
assertion object.public S usingElementComparator(Comparator<? super T> customComparator)
equals
method to compare group
elements for incoming assertion checks.
Custom comparator is bound to assertion instance, meaning that if a new assertion is created, it will use default comparison strategy.
Examples :
// compares invoices by payee assertThat(invoiceList).usingComparator(invoicePayeeComparator).isEqualTo(expectedInvoiceList). // compares invoices by date, doesNotHaveDuplicates and contains both use the given invoice date comparator assertThat(invoiceList).usingComparator(invoiceDateComparator).doesNotHaveDuplicates().contains(may2010Invoice) // as assertThat(invoiceList) creates a new assertion, it falls back to standard comparison strategy // based on Invoice's equal method to compare invoiceList elements to lowestInvoice. assertThat(invoiceList).contains(lowestInvoice). // standard comparison : the fellowshipOfTheRing includes Gandalf but not Sauron (believe me) ... assertThat(fellowshipOfTheRing).contains(gandalf) .doesNotContain(sauron); // ... but if we compare only races, Sauron is in fellowshipOfTheRing because he's a Maia like Gandalf. assertThat(fellowshipOfTheRing).usingElementComparator(raceComparator) .contains(sauron);
usingElementComparator
in interface EnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
customComparator
- the comparator to use for incoming assertion checks.
this
assertion object.public S usingDefaultElementComparator()
This method should be used to disable a custom comparison strategy set by calling
EnumerableAssert.usingElementComparator(Comparator)
.
usingDefaultElementComparator
in interface EnumerableAssert<S extends AbstractIterableAssert<S,A,T>,T>
this
assertion object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |