S
- the "self" type of this assertion class. Please read "Emulating 'self types' using Java Generics to simplify fluent API implementation"
for more details.T
- the type of elements of the "actual" value.public interface ObjectEnumerableAssert<S extends ObjectEnumerableAssert<S,T>,T> extends EnumerableAssert<S,T>
Modifier and Type | Method and Description |
---|---|
S |
are(Condition<? super T> condition)
Verifies that each element value satisfies the given condition
|
S |
areAtLeast(int n,
Condition<? super T> condition)
Verifies that there is at least n elements in the actual group satisfying the given condition.
|
S |
areAtMost(int n,
Condition<? super T> condition)
Verifies that there is at most n elements in the actual group satisfying the given condition.
|
S |
areExactly(int n,
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 n,
Condition<? super T> condition)
Deprecated.
Verifies that there is at least n elements in the actual group not satisfying the
given condition.
|
S |
areNotAtMost(int n,
Condition<? super T> condition)
Deprecated.
Verifies that there is at most n elements in the actual group not satisfying the
given condition.
|
S |
areNotExactly(int n,
Condition<? super T> condition)
Deprecated.
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.
This assertion should only be used with Iterable that have a consistent iteration order (i.e. |
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 n,
Condition<? super T> condition)
Deprecated.
This method is an alias
areNotAtLeast(int, Condition) . |
S |
doNotHaveAtMost(int n,
Condition<? super T> condition)
Deprecated.
This method is an alias
areNotAtMost(int, Condition) . |
S |
doNotHaveExactly(int n,
Condition<? super T> condition)
Deprecated.
This method is an alias
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 |
have(Condition<? super T> condition)
Verifies that each element value satisfies the given condition
|
S |
haveAtLeast(int n,
Condition<? super T> condition)
This method is an alias for
areAtLeast(int, Condition) . |
S |
haveAtMost(int n,
Condition<? super T> condition)
This method is an alias
areAtMost(int, Condition) . |
S |
haveExactly(int n,
Condition<? super T> condition)
This method is an alias
areExactly(int, Condition) . |
S |
startsWith(T... sequence)
Verifies that the actual group starts with the given sequence of objects, without any other objects between them.
|
hasSameSizeAs, hasSameSizeAs, hasSize, isEmpty, isNotEmpty, isNullOrEmpty, usingDefaultElementComparator, usingElementComparator
S contains(T... values)
values
- the given values.this
assertion object.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual group is null
.AssertionError
- if the actual group does not contain the given values.S containsOnly(T... values)
values
- the given values.this
assertion object.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual group is null
.AssertionError
- if the actual group does not contain the given values, i.e. the actual group contains some
or none of the given values, or the actual group contains more values than the given ones.S containsExactly(T... values)
HashSet
, prefer containsOnly(Object...)
in that case).
Example :
Iterable<Ring> elvesRings = newArrayList(vilya, nenya, narya); // assertion will pass assertThat(elvesRings).containsExactly(vilya, nenya, narya); // assertion will fail as actual and expected orders differ. assertThat(elvesRings).containsExactly(nenya, vilya, narya);
values
- the given values.this
assertion object.NullPointerException
- if the given argument is null
.AssertionError
- if the actual group is null
.AssertionError
- if the actual group does not contain the given values with same order, i.e. the actual group
contains some or none of the given values, or the actual group contains more values than the given ones
or values are teh same but the order is not.S containsSequence(T... sequence)
sequence
- the sequence of objects to look for.AssertionError
- if the actual group is null
.AssertionError
- if the given array is null
.AssertionError
- if the actual group does not contain the given sequence.S doesNotContain(T... values)
values
- the given values.this
assertion object.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual group is null
.AssertionError
- if the actual group contains any of the given values.S doesNotHaveDuplicates()
this
assertion object.AssertionError
- if the actual group is null
.AssertionError
- if the actual group contains duplicates.S startsWith(T... sequence)
containsSequence(Object...)
, but it also verifies that the first element in the
sequence is also first element of the actual group.sequence
- the sequence of objects to look for.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual group is null
.AssertionError
- if the actual group does not start with the given sequence of objects.S endsWith(T... sequence)
containsSequence(Object...)
, but it also verifies that the last element in the
sequence is also last element of the actual group.sequence
- the sequence of objects to look for.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual group is null
.AssertionError
- if the actual group does not end with the given sequence of objects.S containsNull()
this
assertion object.AssertionError
- if the actual group is null
.AssertionError
- if the actual group does not contain a null element.S doesNotContainNull()
this
assertion object.AssertionError
- if the actual group is null
.AssertionError
- if the actual group contains a null element.S are(Condition<? super T> condition)
condition
- the given condition.this
object.NullPointerException
- if the given condition is null
.AssertionError
- if a element cannot be cast to E.AssertionError
- if one or more element not satisfy the given condition.S areNot(Condition<? super T> condition)
condition
- the given condition.this
object.NullPointerException
- if the given condition is null
.AssertionError
- if a element cannot be cast to E.AssertionError
- if one or more element satisfy the given condition.S have(Condition<? super T> condition)
condition
- the given condition.this
object.NullPointerException
- if the given condition is null
.AssertionError
- if a element cannot be cast to E.AssertionError
- if one or more element not satisfy the given condition.S doNotHave(Condition<? super T> condition)
condition
- the given condition.this
object.NullPointerException
- if the given condition is null
.AssertionError
- if a element cannot be cast to E.AssertionError
- if one or more element satisfy the given condition.S areAtLeast(int n, Condition<? super T> condition)
n
- the minimum number of times the condition should be verified.condition
- the given condition.this
object.NullPointerException
- if the given condition is null
.AssertionError
- if an element can not be cast to E.AssertionError
- if the number of elements satisfying the given condition is < n.S areNotAtLeast(int n, Condition<? super T> condition)
n
- the number of times the condition should not be verified at least.condition
- the given condition.this
object.NullPointerException
- if the given condition is null
.AssertionError
- if a element cannot be cast to E.AssertionError
- if the number of elements not satisfying the given condition is < n.S areAtMost(int n, Condition<? super T> condition)
n
- the number of times the condition should be at most verified.condition
- the given condition.this
object.NullPointerException
- if the given condition is null
.AssertionError
- if a element cannot be cast to E.AssertionError
- if the number of elements satisfying the given condition is > n.S areNotAtMost(int n, Condition<? super T> condition)
n
- the number of times the condition should not be verified at most.condition
- the given condition.this
object.NullPointerException
- if the given condition is null
.AssertionError
- if a element cannot be cast to E.AssertionError
- if the number of elements not satisfying the given condition is > n.S areExactly(int n, Condition<? super T> condition)
n
- the exact number of times the condition should be verified.condition
- the given condition.this
object.NullPointerException
- if the given condition is null
.AssertionError
- if a element cannot be cast to E.AssertionError
- if the number of elements satisfying the given condition is ≠ n.S areNotExactly(int n, Condition<? super T> condition)
n
- the exact number of times the condition should not be verified.condition
- the given condition.this
object.NullPointerException
- if the given condition is null
.AssertionError
- if a element cannot be cast to E.AssertionError
- if the number of elements not satisfying the given condition is ≠ n.S haveAtLeast(int n, Condition<? super T> condition)
areAtLeast(int, Condition)
.S doNotHaveAtLeast(int n, Condition<? super T> condition)
areNotAtLeast(int, Condition)
.S haveAtMost(int n, Condition<? super T> condition)
areAtMost(int, Condition)
.S doNotHaveAtMost(int n, Condition<? super T> condition)
areNotAtMost(int, Condition)
.S haveExactly(int n, Condition<? super T> condition)
areExactly(int, Condition)
.S doNotHaveExactly(int n, Condition<? super T> condition)
areNotExactly(int, Condition)
.S containsAll(Iterable<? extends T> iterable)
Iterable
, in any order.iterable
- the given Iterable
we will get elements from.this
assertion object.NullPointerException
- if the given argument is null
.AssertionError
- if the actual group is null
.AssertionError
- if the actual group does not contain all the elements of given Iterable
.Copyright © 2013 AssertJ. All Rights Reserved.