Package com.google.common.truth
Class ListSubject<S extends ListSubject<S,T,C>,T,C extends java.util.List<T>>
- java.lang.Object
-
- com.google.common.truth.Subject<S,C>
-
- com.google.common.truth.IterableSubject<S,T,C>
-
- com.google.common.truth.CollectionSubject<S,T,C>
-
- com.google.common.truth.ListSubject<S,T,C>
-
public class ListSubject<S extends ListSubject<S,T,C>,T,C extends java.util.List<T>> extends CollectionSubject<S,T,C>
Propositions forListsubjects.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static interfaceListSubject.PairwiseChecker<T>-
Nested classes/interfaces inherited from class com.google.common.truth.CollectionSubject
CollectionSubject.Has<T,C extends java.util.Collection<T>>
-
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
Constructors Constructor Description ListSubject(FailureStrategy failureStrategy, C list)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcontainsSequence(java.util.List<?> sequence)Fails if the list does not contain the specified sequence.(package private) static <T,C extends java.util.List<T>>
ListSubject<? extends ListSubject<?,T,C>,T,C>create(FailureStrategy failureStrategy, java.util.List<T> list)voidisOrdered()Fails if the list is not strictly ordered according to the natural ordering of its elements.voidisOrdered(java.util.Comparator<T> comparator)Fails if the list is not strictly ordered according to the given comparator.voidisPartiallyOrdered()Fails if the list is not partially ordered according to the natural ordering of its elements.voidisPartiallyOrdered(java.util.Comparator<T> comparator)Fails if the list is not partially ordered according to the given comparator.private voidpairwiseCheck(ListSubject.PairwiseChecker<T> checker)-
Methods inherited from class com.google.common.truth.CollectionSubject
create, has
-
Methods inherited from class com.google.common.truth.IterableSubject
contains, containsAllIn, containsAllOf, containsAnyIn, containsAnyOf, containsExactly, containsExactlyElementsIn, containsNoDuplicates, containsNoneIn, containsNoneOf, containsOnlyElements, containsOnlyElementsIn, create, doesNotContain, hasSize, isEmpty, isNotEmpty, iteratesAs, iteratesAs, iteratesOverSequence
-
Methods inherited from class com.google.common.truth.Subject
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
-
-
-
-
Constructor Detail
-
ListSubject
ListSubject(FailureStrategy failureStrategy, C list)
-
-
Method Detail
-
create
static <T,C extends java.util.List<T>> ListSubject<? extends ListSubject<?,T,C>,T,C> create(FailureStrategy failureStrategy, java.util.List<T> list)
-
containsSequence
public void containsSequence(java.util.List<?> sequence)
Fails if the list does not contain the specified sequence.
-
isOrdered
public void isOrdered()
Fails if the list is not strictly ordered according to the natural ordering of its elements. Null elements are not permitted.- Throws:
java.lang.ClassCastException- if any pair of elements is not mutually Comparable.java.lang.NullPointerException- if any element is null.
-
isPartiallyOrdered
public void isPartiallyOrdered()
Fails if the list is not partially ordered according to the natural ordering of its elements. Null elements are not permitted.- Throws:
java.lang.ClassCastException- if any pair of elements is not mutually Comparable.java.lang.NullPointerException- if any element is null.
-
isOrdered
public void isOrdered(java.util.Comparator<T> comparator)
Fails if the list is not strictly ordered according to the given comparator. Null elements are not permitted.- Throws:
java.lang.ClassCastException- if any pair of elements is not mutually Comparable.java.lang.NullPointerException- if any element is null.
-
isPartiallyOrdered
public void isPartiallyOrdered(java.util.Comparator<T> comparator)
Fails if the list is not partially ordered according to the given comparator. Null elements are not permitted.- Throws:
java.lang.ClassCastException- if any pair of elements is not mutually Comparable.java.lang.NullPointerException- if any element is null.
-
pairwiseCheck
private void pairwiseCheck(ListSubject.PairwiseChecker<T> checker)
-
-