com.google.common.truth
Class IterableSubject<S extends IterableSubject<S,T,C>,T,C extends Iterable<T>>

java.lang.Object
  extended by com.google.common.truth.Subject<S,C>
      extended by 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

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.common.truth.Subject
Subject.HasField
 
Field Summary
 
Fields inherited from class com.google.common.truth.Subject
failureStrategy
 
Constructor Summary
protected IterableSubject(FailureStrategy failureStrategy, C list)
           
 
Method Summary
static
<T,C extends Iterable<T>>
IterableSubject<? extends IterableSubject<?,T,C>,T,C>
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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IterableSubject

protected IterableSubject(FailureStrategy failureStrategy,
                          C list)
Method Detail

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, Sets), 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.