public class IterableSubject<S extends IterableSubject<S,T,C>,T,C extends Iterable<T>> extends Subject<S,C>
Iterable
subjects.failureStrategy
Modifier | Constructor and Description |
---|---|
protected |
IterableSubject(FailureStrategy failureStrategy,
C list) |
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.
|
void |
doesNotContain(Object element)
Attests (with a side-effect failure) that the subject does not contain
the supplied item.
|
protected void |
failWithBadResultsAndSuffix(String verb,
Object expected,
String failVerb,
Object actual,
String suffix)
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<? super T> comparator)
Fails if the iterable is not ordered, according to the given comparator.
|
void |
isPartiallyOrdered()
Deprecated.
Use
isOrdered() instead. |
void |
isPartiallyOrdered(Comparator<? super T> 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<? super T> 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, named
protected IterableSubject(FailureStrategy failureStrategy, @Nullable C list)
public final void isEmpty()
public final void isNotEmpty()
public final void hasSize(int expectedSize)
public final void contains(@Nullable Object element)
public final void doesNotContain(@Nullable Object element)
public final void containsNoDuplicates()
public final void containsAnyOf(@Nullable Object first, @Nullable Object second, @Nullable Object... rest)
public final void containsAnyIn(Iterable<?> expected)
public final Ordered containsAllOf(@Nullable Object first, @Nullable Object second, @Nullable Object... rest)
Callers may optionally chain an inOrder()
call if its expected
contents must be contained in the given order.
public final Ordered containsAllIn(Iterable<?> expected)
Callers may optionally chain an inOrder()
call if its expected
contents must be contained in the given order.
public final 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 final 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.
protected final void failWithBadResultsAndSuffix(String verb, Object expected, String failVerb, Object actual, String suffix)
verb
- the proposition being assertedexpected
- the expectations against which the subject is comparedfailVerb
- the failure of the proposition being assertedactual
- the actual value the subject was compared againstsuffix
- a suffix to append to the failure messagepublic final void containsNoneOf(@Nullable Object first, @Nullable Object second, @Nullable Object... rest)
public final void containsNoneIn(Iterable<?> excluded)
public final void isStrictlyOrdered()
ClassCastException
- if any pair of elements is not mutually ComparableNullPointerException
- if any element is nullpublic final void isStrictlyOrdered(Comparator<? super T> comparator)
ClassCastException
- if any pair of elements is not mutually Comparablepublic final void isOrdered()
ClassCastException
- if any pair of elements is not mutually ComparableNullPointerException
- 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.Copyright © 2015. All Rights Reserved.