public class IterableSubject<S extends IterableSubject<S extends Subject,T ,C> ,T ,C extends Iterable <T>> <S ,C>
Iterable subjects.
failureStrategy| Modifier | Constructor and Description |
|---|---|
protected |
IterableSubject(FailureStrategy
|
| Modifier and Type | Method and Description |
|---|---|
void |
contains(Object
Attests (with a side-effect failure) that the subject contains the supplied item.
|
Ordered |
containsAllIn(Iterable
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
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
Attests that a Collection contains at least one of the objects contained in the provided collection or fails.
|
void |
containsAnyOf(Object
Attests that the subject contains at least one of the provided objects or fails.
|
Ordered |
containsExactly(Object
Attests that a subject contains exactly the provided objects or fails.
|
Ordered |
containsExactlyElementsIn(Iterable
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
Attests that a Collection contains none of the objects contained in the provided collection or fails, eliding duplicates.
|
void |
containsNoneOf(Object
Attests that a subject contains none of the provided objects or fails, eliding duplicates.
|
void |
doesNotContain(Object
Attests (with a side-effect failure) that the subject does not contain the supplied item.
|
protected void |
failWithBadResultsAndSuffix(String
Fails with the bad results and a suffix.
|
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 |
isOrdered()
Fails if the iterable is not ordered, according to the natural ordering of its elements.
|
void |
isOrdered(Comparator
Fails if the iterable is not ordered, according to the given comparator.
|
void |
isPartiallyOrdered()
Deprecated.
Use
isOrdered() instead.
|
void |
isPartiallyOrdered(Comparator
Deprecated.
Use
isOrdered(Comparator) instead.
|
void |
isStrictlyOrdered()
Fails if the iterable is not strictly ordered, according to the natural ordering of its elements.
|
void |
isStrictlyOrdered(Comparator
Fails if the iterable is not strictly ordered, according to the given comparator.
|
check, equals, fail, fail, fail, failWithBadResults, failWithCustomSubject, failWithoutSubject, failWithRawMessage, getDisplaySubject, getSubject, hashCode, internalCustomName, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameAs, isNull, isSameAs, namedprotected IterableSubject(FailureStrategyfailureStrategy, C list)
public final void isEmpty()
public final void isNotEmpty()
public final void hasSize(int expectedSize)
public final void contains(Objectelement)
public final void doesNotContain(Objectelement)
public final void containsNoDuplicates()
public final void containsAnyOf(Objectfirst, Object second, Object ... rest)
public final void containsAnyIn(Iterable<?> expected)
public final OrderedcontainsAllOf(Object first, Object second, Object ... rest)
Callers may optionally chain an inOrder() call if its expected contents must be contained in the given order.
public final OrderedcontainsAllIn(Iterable <?> expected)
Callers may optionally chain an inOrder() call if its expected contents must be contained in the given order.
public final OrderedcontainsExactly(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 final OrderedcontainsExactlyElementsIn(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.
protected final void failWithBadResultsAndSuffix(Stringverb, Object expected, String failVerb, Object actual, String suffix)
verb - the proposition being asserted
expected - the expectations against which the subject is compared
failVerb - the failure of the proposition being asserted
actual - the actual value the subject was compared against
suffix - a suffix to append to the failure message
public final void containsNoneOf(Objectfirst, Object second, Object ... rest)
public final void containsNoneIn(Iterable<?> excluded)
public final void isStrictlyOrdered()
ClassCastException - if any pair of elements is not mutually Comparable
NullPointerException - if any element is null
public final void isStrictlyOrdered(Comparator<? super T> comparator)
ClassCastException - if any pair of elements is not mutually Comparable
public final void isOrdered()
ClassCastException - if any pair of elements is not mutually Comparable
NullPointerException - if any element is null
@Deprecated public final void isPartiallyOrdered()
isOrdered() instead.
public final void isOrdered(Comparator<? super T> comparator)
ClassCastException - if any pair of elements is not mutually Comparable
@Deprecated public final void isPartiallyOrdered(Comparator<? super T> comparator)
isOrdered(Comparator) instead.