Constructor and Description |
---|
Iterables(ComparisonStrategy comparisonStrategy) |
Modifier and Type | Method and Description |
---|---|
<E> void |
assertAllMatch(AssertionInfo info,
Iterable<? extends E> actual,
Predicate<? super E> predicate,
PredicateDescription predicateDescription) |
<E> void |
assertAllSatisfy(AssertionInfo info,
Iterable<? extends E> actual,
Consumer<? super E> requirements) |
<E> void |
assertAnyMatch(AssertionInfo info,
Iterable<? extends E> actual,
Predicate<? super E> predicate,
PredicateDescription predicateDescription) |
<E> void |
assertAnySatisfy(AssertionInfo info,
Iterable<? extends E> actual,
Consumer<? super E> requirements) |
<T> void |
assertAre(AssertionInfo info,
Iterable<? extends T> actual,
Condition<? super T> condition)
Assert that each element of given
Iterable satisfies the given condition. |
<E> void |
assertAreAtLeast(AssertionInfo info,
Iterable<? extends E> actual,
int times,
Condition<? super E> condition)
Assert that there are at least n elements in the actual
Iterable satisfying the given
condition. |
<E> void |
assertAreAtMost(AssertionInfo info,
Iterable<? extends E> actual,
int n,
Condition<? super E> condition)
Assert that there are at most n elements in the actual
Iterable satisfying the given
condition. |
<E> void |
assertAreExactly(AssertionInfo info,
Iterable<? extends E> actual,
int times,
Condition<? super E> condition)
Verifies that there are exactly n elements in the actual
Iterable satisfying the given
condition. |
<E> void |
assertAreNot(AssertionInfo info,
Iterable<? extends E> actual,
Condition<? super E> condition)
Assert that each element of given
Iterable not satisfies the given condition. |
void |
assertContains(AssertionInfo info,
Iterable<?> actual,
Object[] values)
Asserts that the given
Iterable contains the given values, in any order. |
void |
assertContainsAll(AssertionInfo info,
Iterable<?> actual,
Iterable<?> other)
Asserts that the given
Iterable contains all the elements of the other Iterable , in any order. |
void |
assertContainsAnyOf(AssertionInfo info,
Iterable<?> actual,
Object[] values)
Asserts that the given
Iterable contains at least one of the given values . |
void |
assertContainsExactly(AssertionInfo info,
Iterable<?> actual,
Object[] values)
Asserts that the given
Iterable contains exactly the given values and nothing else, in order. |
void |
assertContainsExactlyInAnyOrder(AssertionInfo info,
Iterable<?> actual,
Object[] values) |
void |
assertContainsNull(AssertionInfo info,
Iterable<?> actual)
Asserts that the given
Iterable contains at least a null element. |
void |
assertContainsOnly(AssertionInfo info,
Iterable<?> actual,
Object[] expectedValues)
Asserts that the given
Iterable contains only the given values and nothing else, in any order. |
void |
assertContainsOnlyNulls(AssertionInfo info,
Iterable<?> actual)
Asserts that the given
Iterable contains only null elements and nothing else. |
void |
assertContainsOnlyOnce(AssertionInfo info,
Iterable<?> actual,
Object[] values)
Asserts that the given
Iterable contains the given values and only once. |
void |
assertContainsSequence(AssertionInfo info,
Iterable<?> actual,
Object[] sequence)
Verifies that the given
contains the given sequence of objects, without any other
objects between them. |
void |
assertContainsSubsequence(AssertionInfo info,
Iterable<?> actual,
List<?> subsequence) |
void |
assertContainsSubsequence(AssertionInfo info,
Iterable<?> actual,
Object[] subsequence)
Verifies that the given
contains the given subsequence of objects (possibly with
other values between them). |
void |
assertDoesNotContain(AssertionInfo info,
Iterable<?> actual,
Object[] values)
Asserts that the given
Iterable does not contain the given values. |
<T> void |
assertDoesNotContainAnyElementsOf(AssertionInfo info,
Iterable<? extends T> actual,
Iterable<? extends T> iterable)
Asserts that the given
Iterable does not contain the given values. |
void |
assertDoesNotContainNull(AssertionInfo info,
Iterable<?> actual)
Asserts that the given
Iterable does not contain null elements. |
void |
assertDoesNotContainSequence(AssertionInfo info,
Iterable<?> actual,
Object[] sequence)
Verifies that the given
does not contain the given sequence of objects in order. |
void |
assertDoesNotContainSubsequence(AssertionInfo info,
Iterable<?> actual,
Object[] subsequence)
Verifies that the given
does not contain the given subsequence of objects (possibly
with other values between them). |
void |
assertDoesNotHaveDuplicates(AssertionInfo info,
Iterable<?> actual)
Asserts that the given
Iterable does not have duplicate values. |
<E> void |
assertDoNotHave(AssertionInfo info,
Iterable<? extends E> actual,
Condition<? super E> condition)
Assert that each element of given
Iterable not satisfies the given condition. |
void |
assertEmpty(AssertionInfo info,
Iterable<?> actual)
Asserts that the given
Iterable is empty. |
void |
assertEndsWith(AssertionInfo info,
Iterable<?> actual,
Object[] sequence)
Verifies that the given
Iterable ends with the given sequence of objects, without any other objects between
them. |
void |
assertEndsWith(AssertionInfo info,
Iterable<?> actual,
Object first,
Object[] rest)
Verifies that the given
Iterable ends with the given sequence of objects, without any other objects between
them. |
<T> void |
assertHasOnlyOneElementSatisfying(AssertionInfo info,
Iterable<? extends T> actual,
Consumer<? super T> consumer)
|
void |
assertHasSameSizeAs(AssertionInfo info,
Iterable<?> actual,
Iterable<?> other)
Assert that the actual
Iterable has the same size as the other Iterable . |
void |
assertHasSameSizeAs(AssertionInfo info,
Iterable<?> actual,
Object other)
Assert that the actual
Iterable has the same size as the other array. |
void |
assertHasSize(AssertionInfo info,
Iterable<?> actual,
int expectedSize)
Asserts that the number of elements in the given
Iterable is equal to the expected one. |
void |
assertHasSizeBetween(AssertionInfo info,
Iterable<?> actual,
int lowerBoundary,
int higherBoundary)
Asserts that the number of elements in the given
Iterable is between the given lower and higher boundary (inclusive). |
void |
assertHasSizeGreaterThan(AssertionInfo info,
Iterable<?> actual,
int boundary)
Asserts that the number of elements in the given
Iterable is greater than the boundary. |
void |
assertHasSizeGreaterThanOrEqualTo(AssertionInfo info,
Iterable<?> actual,
int boundary)
Asserts that the number of elements in the given
Iterable is greater than or equal to the boundary. |
void |
assertHasSizeLessThan(AssertionInfo info,
Iterable<?> actual,
int boundary)
Asserts that the number of elements in the given
Iterable is less than the boundary. |
void |
assertHasSizeLessThanOrEqualTo(AssertionInfo info,
Iterable<?> actual,
int boundary)
Asserts that the number of elements in the given
Iterable is less than or equal to the boundary. |
<E> void |
assertHave(AssertionInfo info,
Iterable<? extends E> actual,
Condition<? super E> condition)
Assert that each element of given
Iterable satisfies the given condition. |
<E> void |
assertHaveAtLeast(AssertionInfo info,
Iterable<? extends E> actual,
int times,
Condition<? super E> condition)
An alias method of
assertAreAtLeast(AssertionInfo, Iterable, int, Condition) to provide a richer fluent
api (same logic, only error message differs). |
<E> void |
assertHaveAtMost(AssertionInfo info,
Iterable<? extends E> actual,
int times,
Condition<? super E> condition)
An alias method of
assertAreAtMost(AssertionInfo, Iterable, int, Condition) to provide a richer fluent api
(same logic, only error message differs). |
<E> void |
assertHaveExactly(AssertionInfo info,
Iterable<? extends E> actual,
int times,
Condition<? super E> condition)
An alias method of
assertAreExactly(AssertionInfo, Iterable, int, Condition) to provide a richer fluent
api (same logic, only error message differs). |
void |
assertIsSubsetOf(AssertionInfo info,
Iterable<?> actual,
Iterable<?> values)
Verifies that the actual
Iterable is a subset of values Iterable . |
<E> void |
assertNoneMatch(AssertionInfo info,
Iterable<? extends E> actual,
Predicate<? super E> predicate,
PredicateDescription predicateDescription) |
<E> void |
assertNoneSatisfy(AssertionInfo info,
Iterable<? extends E> actual,
Consumer<? super E> restrictions) |
void |
assertNotEmpty(AssertionInfo info,
Iterable<?> actual)
Asserts that the given
Iterable is not empty. |
void |
assertNullOrEmpty(AssertionInfo info,
Iterable<?> actual)
Asserts that the given
is null or empty. |
void |
assertStartsWith(AssertionInfo info,
Iterable<?> actual,
Object[] sequence)
Verifies that the given
Iterable starts with the given sequence of objects, without any other objects
between them. |
<ACTUAL_ELEMENT,OTHER_ELEMENT> |
assertZipSatisfy(AssertionInfo info,
Iterable<? extends ACTUAL_ELEMENT> actual,
Iterable<OTHER_ELEMENT> other,
BiConsumer<? super ACTUAL_ELEMENT,OTHER_ELEMENT> zipRequirements) |
static <T> Predicate<T> |
byPassingAssertions(Consumer<? super T> assertions) |
Comparator<?> |
getComparator() |
ComparisonStrategy |
getComparisonStrategy() |
static Iterables |
instance()
Returns the singleton instance of this class based on
StandardComparisonStrategy . |
public Iterables(ComparisonStrategy comparisonStrategy)
public static Iterables instance()
StandardComparisonStrategy
.StandardComparisonStrategy
.public Comparator<?> getComparator()
public ComparisonStrategy getComparisonStrategy()
public void assertNullOrEmpty(AssertionInfo info, Iterable<?> actual)
Iterable
is null
or empty.info
- contains information about the assertion.actual
- the given Iterable
.AssertionError
- if the given Iterable
is not null
*and* contains one or more elements.public void assertEmpty(AssertionInfo info, Iterable<?> actual)
Iterable
is empty.info
- contains information about the assertion.actual
- the given Iterable
.AssertionError
- if the given Iterable
is null
.AssertionError
- if the given Iterable
is not empty.public void assertNotEmpty(AssertionInfo info, Iterable<?> actual)
Iterable
is not empty.info
- contains information about the assertion.actual
- the given Iterable
.AssertionError
- if the given Iterable
is null
.AssertionError
- if the given Iterable
is empty.public void assertHasSize(AssertionInfo info, Iterable<?> actual, int expectedSize)
Iterable
is equal to the expected one.info
- contains information about the assertion.actual
- the given Iterable
.expectedSize
- the expected size of actual
.AssertionError
- if the given Iterable
is null
.AssertionError
- if the number of elements in the given Iterable
is different than the expected one.public <T> void assertHasOnlyOneElementSatisfying(AssertionInfo info, Iterable<? extends T> actual, Consumer<? super T> consumer)
Iterable
satisfies the given assertions expressed as a Consumer
,T
- the type of elements in actual.info
- contains information about the assertion.actual
- the given Iterable
.consumer
- the given requirements.AssertionError
- if the Iterable
does not have a unique element.AssertionError
- if the Iterable
's unique element does not satisfies the given assertions.public void assertHasSizeGreaterThan(AssertionInfo info, Iterable<?> actual, int boundary)
Iterable
is greater than the boundary.info
- contains information about the assertion.actual
- the given Iterable
.boundary
- the given value to compare the size of actual
to.AssertionError
- if the given Iterable
is null
.AssertionError
- if the number of elements in the given Iterable
is greater than the boundary.public void assertHasSizeGreaterThanOrEqualTo(AssertionInfo info, Iterable<?> actual, int boundary)
Iterable
is greater than or equal to the boundary.info
- contains information about the assertion.actual
- the given Iterable
.boundary
- the given value to compare the size of actual
to.AssertionError
- if the given Iterable
is null
.AssertionError
- if the number of elements in the given Iterable
is greater than or equal to the boundary.public void assertHasSizeLessThan(AssertionInfo info, Iterable<?> actual, int boundary)
Iterable
is less than the boundary.info
- contains information about the assertion.actual
- the given Iterable
.boundary
- the given value to compare the size of actual
to.AssertionError
- if the given Iterable
is null
.AssertionError
- if the number of elements in the given Iterable
is less than the expected one.public void assertHasSizeLessThanOrEqualTo(AssertionInfo info, Iterable<?> actual, int boundary)
Iterable
is less than or equal to the boundary.info
- contains information about the assertion.actual
- the given Iterable
.boundary
- the given value to compare the size of actual
to.AssertionError
- if the given Iterable
is null
.AssertionError
- if the number of elements in the given Iterable
is less than or equal to the boundary.public void assertHasSizeBetween(AssertionInfo info, Iterable<?> actual, int lowerBoundary, int higherBoundary)
Iterable
is between the given lower and higher boundary (inclusive).info
- contains information about the assertion.actual
- the given Iterable
.lowerBoundary
- the lower boundary compared to which actual size should be greater than or equal to.higherBoundary
- the higher boundary compared to which actual size should be less than or equal to.AssertionError
- if the given array is null
.AssertionError
- if the number of elements in the given array is not between the boundaries.public void assertHasSameSizeAs(AssertionInfo info, Iterable<?> actual, Object other)
Iterable
has the same size as the other array.info
- contains information about the assertion.actual
- the given Iterable
.other
- the given array to compare.AssertionError
- if the actual group is null
.AssertionError
- if the other group is null
.AssertionError
- if actual Iterable
and other array don't have the same size.public void assertHasSameSizeAs(AssertionInfo info, Iterable<?> actual, Iterable<?> other)
Iterable
has the same size as the other Iterable
.info
- contains information about the assertion.actual
- the given Iterable
.other
- the given Iterable
.AssertionError
- if the actual group is null
.AssertionError
- if the other group is null
.AssertionError
- if actual and other Iterable
don't have the same size.public void assertContains(AssertionInfo info, Iterable<?> actual, Object[] values)
Iterable
contains the given values, in any order.info
- contains information about the assertion.actual
- the given Iterable
.values
- the values that are expected to be in the given Iterable
.NullPointerException
- if the array of values is null
.IllegalArgumentException
- if the array of values is empty.AssertionError
- if the given Iterable
is null
.AssertionError
- if the given Iterable
does not contain the given values.public void assertContainsOnly(AssertionInfo info, Iterable<?> actual, Object[] expectedValues)
Iterable
contains only the given values and nothing else, in any order.info
- contains information about the assertion.actual
- the given Iterable
.expectedValues
- the values that are expected to be in the given Iterable
.NullPointerException
- if the array of values is null
.IllegalArgumentException
- if the array of values is empty.AssertionError
- if the given Iterable
is null
.AssertionError
- if the given Iterable
does not contain the given values or if the given
Iterable
contains values that are not in the given array.public void assertContainsOnlyOnce(AssertionInfo info, Iterable<?> actual, Object[] values)
Iterable
contains the given values and only once.info
- contains information about the assertion.actual
- the given Iterable
.values
- the values that are expected to be in the given Iterable
.NullPointerException
- if the array of values is null
.IllegalArgumentException
- if the array of values is empty.AssertionError
- if the given Iterable
is null
.AssertionError
- if the given Iterable
does not contain the given values or if the given
Iterable
contains values that are not in the given array.public void assertContainsOnlyNulls(AssertionInfo info, Iterable<?> actual)
Iterable
contains only null elements and nothing else.info
- contains information about the assertion.actual
- the given Iterable
.AssertionError
- if the given Iterable
is null
.AssertionError
- if the given Iterable
does not contain at least a null element or if the given
Iterable
contains values that are not null elements.public void assertContainsSequence(AssertionInfo info, Iterable<?> actual, Object[] sequence)
Iterable
contains the given sequence of objects, without any other
objects between them.info
- contains information about the assertion.actual
- the given Iterable
.sequence
- the sequence of objects to look for.AssertionError
- if the given Iterable
is null
.NullPointerException
- if the given sequence is null
.IllegalArgumentException
- if the given sequence is empty.AssertionError
- if the given Iterable
does not contain the given sequence of objects.public void assertDoesNotContainSequence(AssertionInfo info, Iterable<?> actual, Object[] sequence)
Iterable
does not contain the given sequence of objects in order.info
- contains information about the assertion.actual
- the given Iterable
.sequence
- the sequence of objects to look for.AssertionError
- if the given Iterable
is null
.NullPointerException
- if the given sequence is null
.IllegalArgumentException
- if the given sequence is empty.AssertionError
- if the given Iterable
does contain the given sequence of objects.public void assertContainsSubsequence(AssertionInfo info, Iterable<?> actual, Object[] subsequence)
Iterable
contains the given subsequence of objects (possibly with
other values between them).info
- contains information about the assertion.actual
- the given Iterable
.subsequence
- the subsequence of objects to look for.AssertionError
- if the given Iterable
is null
.NullPointerException
- if the given sequence is null
.IllegalArgumentException
- if the given subsequence is empty.AssertionError
- if the given Iterable
does not contain the given subsequence of objects.public void assertContainsSubsequence(AssertionInfo info, Iterable<?> actual, List<?> subsequence)
public void assertDoesNotContainSubsequence(AssertionInfo info, Iterable<?> actual, Object[] subsequence)
Iterable
does not contain the given subsequence of objects (possibly
with other values between them).info
- contains information about the assertion.actual
- the given Iterable
.subsequence
- the subsequence of objects to look for.AssertionError
- if the given Iterable
is null
.NullPointerException
- if the given sequence is null
.IllegalArgumentException
- if the given subsequence is empty.AssertionError
- if the given Iterable
contains the given subsequence of objects.public void assertIsSubsetOf(AssertionInfo info, Iterable<?> actual, Iterable<?> values)
Iterable
is a subset of values Iterable
. info
- contains information about the assertion.actual
- the actual Iterable
.values
- the Iterable
that should contain all actual elements.AssertionError
- if the actual Iterable
is null
.NullPointerException
- if the given Iterable is null
.AssertionError
- if the actual Iterable
is not subset of set Iterable
public void assertDoesNotContain(AssertionInfo info, Iterable<?> actual, Object[] values)
Iterable
does not contain the given values.info
- contains information about the assertion.actual
- the given Iterable
.values
- the values that are expected not to be in the given Iterable
.NullPointerException
- if the array of values is null
.IllegalArgumentException
- if the array of values is empty.AssertionError
- if the given Iterable
is null
.AssertionError
- if the given Iterable
contains any of given values.public <T> void assertDoesNotContainAnyElementsOf(AssertionInfo info, Iterable<? extends T> actual, Iterable<? extends T> iterable)
Iterable
does not contain the given values.T
- the type of actual elementsinfo
- contains information about the assertion.actual
- the given Iterable
.iterable
- the values that are expected not to be in the given Iterable
.NullPointerException
- if the array of values is null
.IllegalArgumentException
- if the array of values is empty.AssertionError
- if the given Iterable
is null
.AssertionError
- if the given Iterable
contains any of given values.public void assertDoesNotHaveDuplicates(AssertionInfo info, Iterable<?> actual)
Iterable
does not have duplicate values.info
- contains information about the assertion.actual
- the given Iterable
.NullPointerException
- if the array of values is null
.IllegalArgumentException
- if the array of values is empty.AssertionError
- if the given Iterable
is null
.AssertionError
- if the given Iterable
contains duplicate values.public void assertStartsWith(AssertionInfo info, Iterable<?> actual, Object[] sequence)
Iterable
starts with the given sequence of objects, without any other objects
between them. Similar to assertContainsSequence(AssertionInfo, Iterable, Object[])
, but it
also verifies that the first element in the sequence is also the first element of the given Iterable
.info
- contains information about the assertion.actual
- the given Iterable
.sequence
- the sequence of objects to look for.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the given Iterable
is null
.AssertionError
- if the given Iterable
does not start with the given sequence of objects.public void assertEndsWith(AssertionInfo info, Iterable<?> actual, Object first, Object[] rest)
Iterable
ends with the given sequence of objects, without any other objects between
them. Similar to assertContainsSequence(AssertionInfo, Iterable, Object[])
, but it also
verifies that the last element in the sequence is also the last element of the given Iterable
.info
- contains information about the assertion.actual
- the given Iterable
.first
- the first element of the end sequence.rest
- the optional next elements of the end sequence.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the given Iterable
is null
.AssertionError
- if the given Iterable
does not end with the given sequence of objects.public void assertEndsWith(AssertionInfo info, Iterable<?> actual, Object[] sequence)
Iterable
ends with the given sequence of objects, without any other objects between
them. Similar to assertContainsSequence(AssertionInfo, Iterable, Object[])
, but it also
verifies that the last element in the sequence is also the last element of the given Iterable
.info
- contains information about the assertion.actual
- the given Iterable
.sequence
- the sequence of objects to look for.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the given Iterable
is null
.AssertionError
- if the given Iterable
does not end with the given sequence of objects.public void assertContainsNull(AssertionInfo info, Iterable<?> actual)
Iterable
contains at least a null element.info
- contains information about the assertion.actual
- the given Iterable
.AssertionError
- if the given Iterable
is null
.AssertionError
- if the given Iterable
does not contain at least a null element.public void assertDoesNotContainNull(AssertionInfo info, Iterable<?> actual)
Iterable
does not contain null elements.info
- contains information about the assertion.actual
- the given Iterable
.AssertionError
- if the given Iterable
is null
.AssertionError
- if the given Iterable
contains a null element.public <T> void assertAre(AssertionInfo info, Iterable<? extends T> actual, Condition<? super T> condition)
Iterable
satisfies the given condition.T
- the type of actual elementsinfo
- contains information about the assertion.actual
- the given Iterable
.condition
- the given Condition
.NullPointerException
- if the given condition is null
.AssertionError
- if an element cannot be cast to T.AssertionError
- if one or more elements do not satisfy the given condition.public <E> void assertAreNot(AssertionInfo info, Iterable<? extends E> actual, Condition<? super E> condition)
Iterable
not satisfies the given condition.E
- the type of actual elementsinfo
- contains information about the assertion.actual
- the given Iterable
.condition
- the given Condition
.NullPointerException
- if the given condition is null
.AssertionError
- if an element cannot be cast to E.AssertionError
- if one or more elements satisfy the given condition.public <E> void assertHave(AssertionInfo info, Iterable<? extends E> actual, Condition<? super E> condition)
Iterable
satisfies the given condition.E
- the type of actual elementsinfo
- contains information about the assertion.actual
- the given Iterable
.condition
- the given Condition
.NullPointerException
- if the given condition is null
.AssertionError
- if an element cannot be cast to E.AssertionError
- if one or more elements do not satisfy the given condition.public <E> void assertDoNotHave(AssertionInfo info, Iterable<? extends E> actual, Condition<? super E> condition)
Iterable
not satisfies the given condition.E
- the type of actual elementsinfo
- contains information about the assertion.actual
- the given Iterable
.condition
- the given Condition
.NullPointerException
- if the given condition is null
.AssertionError
- if an element cannot be cast to E.AssertionError
- if one or more elements satisfy the given condition.public <E> void assertAreAtLeast(AssertionInfo info, Iterable<? extends E> actual, int times, Condition<? super E> condition)
Iterable
satisfying the given
condition.E
- the type of actual elementsinfo
- contains information about the assertion.actual
- the given Iterable
.times
- the minimum number of times the condition should be verified.condition
- the given Condition
.NullPointerException
- if the given condition is null
.AssertionError
- if an element cannot be cast to E.AssertionError
- if the number of elements satisfying the given condition is < n.public <E> void assertAreAtMost(AssertionInfo info, Iterable<? extends E> actual, int n, Condition<? super E> condition)
Iterable
satisfying the given
condition.E
- the type of actual elementsinfo
- contains information about the assertion.actual
- the given Iterable
.n
- the number of times the condition should be at most verified.condition
- the given Condition
.NullPointerException
- if the given condition is null
.AssertionError
- if an element cannot be cast to E.AssertionError
- if the number of elements satisfying the given condition is > n.public <E> void assertAreExactly(AssertionInfo info, Iterable<? extends E> actual, int times, Condition<? super E> condition)
Iterable
satisfying the given
condition.E
- the type of actual elementsinfo
- contains information about the assertion.actual
- the given Iterable
.times
- the exact number of times the condition should be verified.condition
- the given Condition
.NullPointerException
- if the given condition is null
.AssertionError
- if an element cannot be cast to E.AssertionError
- if the number of elements satisfying the given condition is ≠ n.public <E> void assertHaveAtLeast(AssertionInfo info, Iterable<? extends E> actual, int times, Condition<? super E> condition)
assertAreAtLeast(AssertionInfo, Iterable, int, Condition)
to provide a richer fluent
api (same logic, only error message differs).E
- the type of actual elementsinfo
- contains information about the assertion.actual
- the given Iterable
.times
- the minimum number of times the condition should be verified.condition
- the given Condition
.NullPointerException
- if the given condition is null
.AssertionError
- if an element cannot be cast to E.AssertionError
- if the number of elements satisfying the given condition is < n.public <E> void assertHaveAtMost(AssertionInfo info, Iterable<? extends E> actual, int times, Condition<? super E> condition)
assertAreAtMost(AssertionInfo, Iterable, int, Condition)
to provide a richer fluent api
(same logic, only error message differs).E
- the type of actual elementsinfo
- contains information about the assertion.actual
- the given Iterable
.times
- the number of times the condition should be at most verified.condition
- the given Condition
.NullPointerException
- if the given condition is null
.AssertionError
- if an element cannot be cast to E.AssertionError
- if the number of elements satisfying the given condition is > n.public <E> void assertHaveExactly(AssertionInfo info, Iterable<? extends E> actual, int times, Condition<? super E> condition)
assertAreExactly(AssertionInfo, Iterable, int, Condition)
to provide a richer fluent
api (same logic, only error message differs).E
- the type of actual elementsinfo
- contains information about the assertion.actual
- the given Iterable
.times
- the exact number of times the condition should be verified.condition
- the given Condition
.NullPointerException
- if the given condition is null
.AssertionError
- if an element cannot be cast to E.AssertionError
- if the number of elements satisfying the given condition is ≠ n.public void assertContainsAll(AssertionInfo info, Iterable<?> actual, Iterable<?> other)
Iterable
contains all the elements of the other Iterable
, in any order.info
- contains information about the assertion.actual
- the given Iterable
.other
- the other Iterable
.NullPointerException
- if Iterable
is null
.AssertionError
- if the given Iterable
is null
.AssertionError
- if the given Iterable
does not contain all the elements of the other
Iterable
, in any order.public void assertContainsExactly(AssertionInfo info, Iterable<?> actual, Object[] values)
Iterable
contains exactly the given values and nothing else, in order.info
- contains information about the assertion.actual
- the given Iterable
.values
- the values that are expected to be in the given Iterable
in order.NullPointerException
- if the array of values is null
.AssertionError
- if the given Iterable
is null
.AssertionError
- if the given Iterable
does not contain the given values or if the given
Iterable
contains values that are not in the given array, in order.public <E> void assertAllSatisfy(AssertionInfo info, Iterable<? extends E> actual, Consumer<? super E> requirements)
public <ACTUAL_ELEMENT,OTHER_ELEMENT> void assertZipSatisfy(AssertionInfo info, Iterable<? extends ACTUAL_ELEMENT> actual, Iterable<OTHER_ELEMENT> other, BiConsumer<? super ACTUAL_ELEMENT,OTHER_ELEMENT> zipRequirements)
public <E> void assertAnySatisfy(AssertionInfo info, Iterable<? extends E> actual, Consumer<? super E> requirements)
public <E> void assertAllMatch(AssertionInfo info, Iterable<? extends E> actual, Predicate<? super E> predicate, PredicateDescription predicateDescription)
public <E> void assertNoneSatisfy(AssertionInfo info, Iterable<? extends E> actual, Consumer<? super E> restrictions)
public <E> void assertAnyMatch(AssertionInfo info, Iterable<? extends E> actual, Predicate<? super E> predicate, PredicateDescription predicateDescription)
public <E> void assertNoneMatch(AssertionInfo info, Iterable<? extends E> actual, Predicate<? super E> predicate, PredicateDescription predicateDescription)
public void assertContainsAnyOf(AssertionInfo info, Iterable<?> actual, Object[] values)
Iterable
contains at least one of the given values
.info
- contains information about the assertion.actual
- the given Iterable
.values
- the values that, at least one of which is expected to be in the given Iterable
.NullPointerException
- if the array of values is null
.IllegalArgumentException
- if the array of values is empty and given Iterable
is not empty.AssertionError
- if the given Iterable
is null
.AssertionError
- if the given Iterable
does not contain any of given values
.public void assertContainsExactlyInAnyOrder(AssertionInfo info, Iterable<?> actual, Object[] values)
Copyright © 2014–2019 AssertJ. All rights reserved.