public final class LongStreamSubject extends Subject<LongStreamSubject,java.util.stream.LongStream>
LongStream
subjects.
Note: the wrapped stream will be drained immediately into a private collection to provide more readable failure messages. You should not use this class if you intend to leave the stream un-consumed or if the stream is very large or infinite.
If you intend to make multiple assertions on the same stream of data you should instead first collect the contents of the stream into a collection, and then assert directly on that.
For very large or infinite streams you may want to first limit the stream before asserting on it.
Subject.Factory<SubjectT extends Subject,ActualT>
Modifier and Type | Method and Description |
---|---|
protected String |
actualCustomStringRepresentation()
Supplies the direct string representation of the actual value to other methods which may prefix
or otherwise position it in an error message.
|
void |
contains(long element)
Fails if the subject does not contain the given element.
|
Ordered |
containsAllIn(Iterable<?> expected)
Deprecated.
Use
containsAtLeastElementsIn(Iterable) , which is equivalent. |
Ordered |
containsAllOf(long first,
long second,
long... rest)
Deprecated.
Use
containsAtLeast(long, long, long...) , which is equivalent. |
void |
containsAnyIn(Iterable<?> expected)
Fails if the subject does not contain at least one of the given elements.
|
void |
containsAnyOf(long first,
long second,
long... rest)
Fails if the subject does not contain at least one of the given elements.
|
Ordered |
containsAtLeast(long first,
long second,
long... rest)
Fails if the subject does not contain all of the given elements.
|
Ordered |
containsAtLeastElementsIn(Iterable<?> expected)
Fails if the subject does not contain all of the given elements.
|
Ordered |
containsExactly(long... varargs)
Fails if the subject does not contain exactly the given elements.
|
Ordered |
containsExactlyElementsIn(Iterable<?> expected)
Fails if the subject does not contain exactly the given elements.
|
void |
containsNoDuplicates()
Fails if the subject contains duplicate elements.
|
void |
containsNoneIn(Iterable<?> excluded)
Fails if the subject contains any of the given elements.
|
void |
containsNoneOf(long first,
long second,
long... rest)
Fails if the subject contains any of the given elements.
|
void |
doesNotContain(long element)
Fails if the subject contains the given element.
|
void |
hasSize(int expectedSize)
Fails if the subject does not have the given size.
|
void |
isEmpty()
Fails if the subject is not empty.
|
void |
isInOrder()
Fails if the subject is not ordered, according to the natural ordering of its elements.
|
void |
isInOrder(Comparator<?> comparator)
Fails if the subject is not ordered, according to the given comparator.
|
void |
isInStrictOrder()
Fails if the subject is not strictly ordered, according to the natural ordering of its
elements.
|
void |
isInStrictOrder(Comparator<?> comparator)
Fails if the subject is not strictly ordered, according to the given comparator.
|
void |
isNotEmpty()
Fails if the subject is empty.
|
static Subject.Factory<LongStreamSubject,java.util.stream.LongStream> |
longStreams() |
actual, actualAsString, check, equals, failWithActual, failWithActual, failWithoutActual, getSubject, hashCode, ignoreCheck, internalCustomName, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameInstanceAs, isNull, isSameInstanceAs, named, toString
protected String actualCustomStringRepresentation()
Subject
Subjects should override this with care.
By default, this returns String.ValueOf(getActualValue())
.
actualCustomStringRepresentation
in class Subject<LongStreamSubject,java.util.stream.LongStream>
public static Subject.Factory<LongStreamSubject,java.util.stream.LongStream> longStreams()
public void isEmpty()
public void isNotEmpty()
public void hasSize(int expectedSize)
If you'd like to check that your stream contains more than Integer.MAX_VALUE
elements, use assertThat(stream.count()).isEqualTo(...)
.
public void contains(long element)
public void doesNotContain(long element)
public void containsNoDuplicates()
public void containsAnyOf(long first, long second, long... rest)
public void containsAnyIn(Iterable<?> expected)
@CanIgnoreReturnValue public Ordered containsAtLeast(long first, long second, long... rest)
To also test that the contents appear in the given order, make a call to inOrder()
on the object returned by this method. The expected elements must appear in the given order
within the actual elements, but they are not required to be consecutive.
@CanIgnoreReturnValue public Ordered containsAtLeastElementsIn(Iterable<?> expected)
To also test that the contents appear in the given order, make a call to inOrder()
on the object returned by this method. The expected elements must appear in the given order
within the actual elements, but they are not required to be consecutive.
@CanIgnoreReturnValue @Deprecated public Ordered containsAllOf(long first, long second, long... rest)
containsAtLeast(long, long, long...)
, which is equivalent.To also test that the contents appear in the given order, make a call to inOrder()
on the object returned by this method. The expected elements must appear in the given order
within the actual elements, but they are not required to be consecutive.
@CanIgnoreReturnValue @Deprecated public Ordered containsAllIn(Iterable<?> expected)
containsAtLeastElementsIn(Iterable)
, which is equivalent.To also test that the contents appear in the given order, make a call to inOrder()
on the object returned by this method. The expected elements must appear in the given order
within the actual elements, but they are not required to be consecutive.
@CanIgnoreReturnValue public Ordered containsExactly(long... 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.
To also test that the contents appear in the given order, make a call to inOrder()
on the object returned by this method.
@CanIgnoreReturnValue public Ordered containsExactlyElementsIn(Iterable<?> expected)
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.
To also test that the contents appear in the given order, make a call to inOrder()
on the object returned by this method.
public void containsNoneOf(long first, long second, long... rest)
public void containsNoneIn(Iterable<?> excluded)
public void isInStrictOrder()
ClassCastException
- if any pair of elements is not mutually ComparableNullPointerException
- if any element is nullpublic void isInStrictOrder(Comparator<?> comparator)
ClassCastException
- if any pair of elements is not mutually Comparablepublic void isInOrder()
ClassCastException
- if any pair of elements is not mutually ComparableNullPointerException
- if any element is nullpublic void isInOrder(Comparator<?> comparator)
ClassCastException
- if any pair of elements is not mutually ComparableCopyright © 2019. All rights reserved.