com.google.common.truth
Class IterableSubject<S extends IterableSubject<S,T,C>,T,C extends Iterable<T>>
java.lang.Object
com.google.common.truth.Subject<S,C>
com.google.common.truth.IterableSubject<S,T,C>
- Direct Known Subclasses:
- CollectionSubject
public class IterableSubject<S extends IterableSubject<S,T,C>,T,C extends Iterable<T>>
- extends Subject<S,C>
- Author:
- Kevin Bourrillion
Method Summary |
static
|
create(FailureStrategy failureStrategy,
Iterable<T> list)
|
void |
isEmpty()
Attests that the subject holds no more objects, or fails. |
void |
isNotEmpty()
Attests that the subject holds one or more objects, or fails |
void |
iteratesAs(Iterable<?> expectedItems)
Asserts that the items are supplied in the order given by the iterable. |
void |
iteratesAs(Object... expectedItems)
Asserts that the items are supplied in the order given by the iterable. |
void |
iteratesOverSequence(Object... expectedItems)
Deprecated. use #iteratesAs(T...) |
Methods inherited from class com.google.common.truth.Subject |
check, equals, fail, failWithBadResults, failWithCustomSubject, failWithoutSubject, failWithRawMessage, getDisplaySubject, getSubject, hasField, hashCode, internalCustomName, is, isA, isEqualTo, isNotA, isNotEqualTo, isNotNull, isNull, labeled, named |
IterableSubject
protected IterableSubject(FailureStrategy failureStrategy,
C list)
create
public static <T,C extends Iterable<T>> IterableSubject<? extends IterableSubject<?,T,C>,T,C> create(FailureStrategy failureStrategy,
Iterable<T> list)
isEmpty
public void isEmpty()
- Attests that the subject holds no more objects, or fails.
isNotEmpty
public void isNotEmpty()
- Attests that the subject holds one or more objects, or fails
iteratesAs
public void iteratesAs(Iterable<?> expectedItems)
- Asserts that the items are supplied in the order given by the iterable. If
the iterable under test and/or the
expectedItems
do not provide
iteration order guarantees (say, Set
s), this method may provide
unexpected results. Consider using #is(T)
in such cases, or using
collections and iterables that provide strong order guarantees.
iteratesOverSequence
@Deprecated
public void iteratesOverSequence(Object... expectedItems)
- Deprecated. use
#iteratesAs(T...)
iteratesAs
public void iteratesAs(Object... expectedItems)
- Asserts that the items are supplied in the order given by the iterable. If
the iterable under test does not provide iteration order guarantees (say,
a
Set
), this method is not suitable for asserting that order.
Consider using #is(T)
Copyright © 2014. All rights reserved.