public class IterableSubject<S extends IterableSubject<S,T,C>,T,C extends Iterable<T>> extends Subject<S,C>
Iterable
subjects.Subject.HasField
failureStrategy
Modifier and Type | Method and Description |
---|---|
void |
contains(Object element)
Attests (with a side-effect failure) that the subject contains the
supplied item.
|
Ordered |
containsAllIn(Iterable<?> expected)
Attests that the subject contains at least all of the provided objects
or fails, potentially permitting duplicates in both the subject and the
parameters (if the subject even can have duplicates).
|
Ordered |
containsAllOf(Object first,
Object second,
Object... rest)
Attests that the subject contains at least all of the provided objects
or fails, potentially permitting duplicates in both the subject and the
parameters (if the subject even can have duplicates).
|
void |
containsAnyIn(Iterable<?> expected)
Attests that a Collection contains at least one of the objects contained
in the provided collection or fails.
|
void |
containsAnyOf(Object first,
Object second,
Object... rest)
Attests that the subject contains at least one of the provided objects
or fails.
|
Ordered |
containsExactly(Object... varargs)
Attests that a subject contains exactly the provided objects or fails.
|
Ordered |
containsExactlyElementsIn(Iterable<?> expected)
Attests that a subject contains exactly the provided objects or fails.
|
void |
containsNoDuplicates()
Attests that the subject does not contain duplicate elements.
|
void |
containsNoneIn(Iterable<?> excluded)
Attests that a Collection contains none of the objects contained
in the provided collection or fails, eliding duplicates.
|
void |
containsNoneOf(Object first,
Object second,
Object... rest)
Attests that a subject contains none of the provided objects
or fails, eliding duplicates.
|
Ordered |
containsOnlyElements(Object first,
Object second,
Object... rest)
Deprecated.
Use
containsExactly(Object...) instead. |
Ordered |
containsOnlyElementsIn(Iterable<?> expected)
Deprecated.
Use
containsExactlyElementsIn(Iterable) instead. |
void |
doesNotContain(Object element)
Attests (with a side-effect failure) that the subject does not contain
the supplied item.
|
void |
hasSize(int expectedSize)
Fails if the subject does not have the given size.
|
void |
isEmpty()
Fails if the subject is not empty.
|
void |
isNotEmpty()
Fails if the subject is empty.
|
void |
iteratesAs(Iterable<?> expectedItems)
Deprecated.
Use
containsExactlyElementsIn(Iterable).inOrder() instead. |
void |
iteratesAs(Object... expectedItems)
Deprecated.
Use
containsExactly(Object...).inOrder() instead. |
void |
iteratesOverSequence(Object... expectedItems)
Deprecated.
Use
containsExactly(Object, Object...).inOrder() instead. |
check, equals, fail, fail, fail, failWithBadResults, failWithCustomSubject, failWithoutSubject, failWithRawMessage, getDisplaySubject, getSubject, hasField, hashCode, internalCustomName, is, isA, isEqualTo, isInstanceOf, isNotA, isNotEqualTo, isNotInstanceOf, isNotNull, isNotSameAs, isNull, isSameAs, labeled, named
public void isEmpty()
public void isNotEmpty()
public final void hasSize(int expectedSize)
@Deprecated public void iteratesAs(Object... expectedItems)
containsExactly(Object...).inOrder()
instead.Set
<?>
), this method is not suitable for asserting that order.
Consider using Subject.isEqualTo(Object)
@Deprecated public void iteratesAs(Iterable<?> expectedItems)
containsExactlyElementsIn(Iterable).inOrder()
instead.expectedItems
do not provide
iteration order guarantees (say, Set
<?>
s), this method may provide
unexpected results. Consider using Subject.isEqualTo(Object)
in such cases, or using
collections and iterables that provide strong order guarantees.@Deprecated public void iteratesOverSequence(Object... expectedItems)
containsExactly(Object, Object...).inOrder()
instead.public void contains(@Nullable Object element)
public void doesNotContain(@Nullable Object element)
public void containsNoDuplicates()
public void containsAnyOf(@Nullable Object first, @Nullable Object second, Object... rest)
public void containsAnyIn(Iterable<?> expected)
public Ordered containsAllOf(@Nullable Object first, @Nullable Object second, Object... rest)
Callers may optionally chain an inOrder()
call if its expected
contents must be contained in the given order.
public Ordered containsAllIn(Iterable<?> expected)
Callers may optionally chain an inOrder()
call if its expected
contents must be contained in the given order.
@Deprecated public Ordered containsOnlyElements(@Nullable Object first, @Nullable Object second, Object... rest)
containsExactly(Object...)
instead.Callers may optionally chain an inOrder()
call if its expected
contents must be contained in the given order.
@Deprecated public Ordered containsOnlyElementsIn(Iterable<?> expected)
containsExactlyElementsIn(Iterable)
instead.Callers may optionally chain an inOrder()
call if its expected
contents must be contained in the given order.
public Ordered containsExactly(@Nullable Object... varargs)
Multiplicity is respected. For example, an object duplicated exactly 3 times in the parameters asserts that the object must likewise be duplicated exactly 3 times in the subject.
Callers may optionally chain an inOrder()
call if its expected
contents must be contained in the given order.
public Ordered containsExactlyElementsIn(Iterable<?> expected)
Multiplicity is respected. For example, an object duplicated exactly 3
times in the Iterable
parameter asserts that the object must
likewise be duplicated exactly 3 times in the subject.
Callers may optionally chain an inOrder()
call if its expected
contents must be contained in the given order.
public void containsNoneOf(@Nullable Object first, @Nullable Object second, Object... rest)
public void containsNoneIn(Iterable<?> excluded)
Copyright © 2014. All rights reserved.