Package org.assertj.core.internal
Class Iterables
java.lang.Object
org.assertj.core.internal.Iterables
Reusable assertions for
Iterables.- Author:
- Alex Ruiz, Yvonne Wang, Maciej Jaskowski, Nicolas François, Joel Costigliola, Florent Biville
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<E> voidassertAllMatch(AssertionInfo info, Iterable<? extends E> actual, Predicate<? super E> predicate, PredicateDescription predicateDescription) <E> voidassertAllSatisfy(AssertionInfo info, Iterable<? extends E> actual, Consumer<? super E> requirements) <E> voidassertAnyMatch(AssertionInfo info, Iterable<? extends E> actual, Predicate<? super E> predicate, PredicateDescription predicateDescription) <E> voidassertAnySatisfy(AssertionInfo info, Iterable<? extends E> actual, Consumer<? super E> requirements) <T> voidassertAre(AssertionInfo info, Iterable<? extends T> actual, Condition<? super T> condition) Assert that each element of givenIterablesatisfies the given condition.<E> voidassertAreAtLeast(AssertionInfo info, Iterable<? extends E> actual, int times, Condition<? super E> condition) Assert that there are at least n elements in the actualIterablesatisfying the given condition.<E> voidassertAreAtMost(AssertionInfo info, Iterable<? extends E> actual, int n, Condition<? super E> condition) Assert that there are at most n elements in the actualIterablesatisfying the given condition.<E> voidassertAreExactly(AssertionInfo info, Iterable<? extends E> actual, int times, Condition<? super E> condition) Verifies that there are exactly n elements in the actualIterablesatisfying the given condition.<E> voidassertAreNot(AssertionInfo info, Iterable<? extends E> actual, Condition<? super E> condition) Assert that each element of givenIterablenot satisfies the given condition.voidassertContains(AssertionInfo info, Iterable<?> actual, Object[] values) Asserts that the givenIterablecontains the given values, in any order.voidassertContainsAll(AssertionInfo info, Iterable<?> actual, Iterable<?> other) Asserts that the givenIterablecontains all the elements of the otherIterable, in any order.voidassertContainsAnyOf(AssertionInfo info, Iterable<?> actual, Object[] values) Asserts that the givenIterablecontains at least one of the givenvalues.voidassertContainsExactly(AssertionInfo info, Iterable<?> actual, Object[] values) Asserts that the givenIterablecontains exactly the given values and nothing else, in order.voidassertContainsExactlyInAnyOrder(AssertionInfo info, Iterable<?> actual, Object[] values) voidassertContainsNull(AssertionInfo info, Iterable<?> actual) Asserts that the givenIterablecontains at least a null element.voidassertContainsOnly(AssertionInfo info, Iterable<?> actual, Object[] expectedValues) Asserts that the givenIterablecontains only the given values and nothing else, in any order.voidassertContainsOnlyNulls(AssertionInfo info, Iterable<?> actual) Asserts that the givenIterablecontains only null elements and nothing else.voidassertContainsOnlyOnce(AssertionInfo info, Iterable<?> actual, Object[] values) Asserts that the givenIterablecontains the given values and only once.voidassertContainsSequence(AssertionInfo info, Iterable<?> actual, Object[] sequence) Verifies that the givencontains the given sequence of objects, without any other objects between them.IterablevoidassertContainsSubsequence(AssertionInfo info, Iterable<?> actual, Object[] subsequence) Verifies that the givencontains the given subsequence of objects (possibly with other values between them).IterablevoidassertDoesNotContain(AssertionInfo info, Iterable<?> actual, Object[] values) Asserts that the givenIterabledoes not contain the given values.<T> voidassertDoesNotContainAnyElementsOf(AssertionInfo info, Iterable<? extends T> actual, Iterable<? extends T> iterable) Asserts that the givenIterabledoes not contain the given values.voidassertDoesNotContainNull(AssertionInfo info, Iterable<?> actual) Asserts that the givenIterabledoes not contain null elements.voidassertDoesNotContainSequence(AssertionInfo info, Iterable<?> actual, Object[] sequence) Verifies that the givendoes not contain the given sequence of objects in order.IterablevoidassertDoesNotContainSubsequence(AssertionInfo info, Iterable<?> actual, Object[] subsequence) Verifies that the givendoes not contain the given subsequence of objects (possibly with other values between them).IterablevoidassertDoesNotHaveDuplicates(AssertionInfo info, Iterable<?> actual) Asserts that the givenIterabledoes not have duplicate values.<E> voidassertDoNotHave(AssertionInfo info, Iterable<? extends E> actual, Condition<? super E> condition) Assert that each element of givenIterablenot satisfies the given condition.voidassertEmpty(AssertionInfo info, Iterable<?> actual) Asserts that the givenIterableis empty.voidassertEndsWith(AssertionInfo info, Iterable<?> actual, Object[] sequence) Verifies that the givenIterableends with the given sequence of objects, without any other objects between them.voidassertEndsWith(AssertionInfo info, Iterable<?> actual, Object first, Object[] rest) Verifies that the givenIterableends with the given sequence of objects, without any other objects between them.<T> voidassertHasOnlyOneElementSatisfying(AssertionInfo info, Iterable<? extends T> actual, Consumer<? super T> consumer) voidassertHasSameSizeAs(AssertionInfo info, Iterable<?> actual, Iterable<?> other) Assert that the actualIterablehas the same size as the otherIterable.voidassertHasSameSizeAs(AssertionInfo info, Iterable<?> actual, Object other) Assert that the actualIterablehas the same size as the other array.voidassertHasSize(AssertionInfo info, Iterable<?> actual, int expectedSize) Asserts that the number of elements in the givenIterableis equal to the expected one.voidassertHasSizeBetween(AssertionInfo info, Iterable<?> actual, int lowerBoundary, int higherBoundary) Asserts that the number of elements in the givenIterableis between the given lower and higher boundary (inclusive).voidassertHasSizeGreaterThan(AssertionInfo info, Iterable<?> actual, int boundary) Asserts that the number of elements in the givenIterableis greater than the boundary.voidassertHasSizeGreaterThanOrEqualTo(AssertionInfo info, Iterable<?> actual, int boundary) Asserts that the number of elements in the givenIterableis greater than or equal to the boundary.voidassertHasSizeLessThan(AssertionInfo info, Iterable<?> actual, int boundary) Asserts that the number of elements in the givenIterableis less than the boundary.voidassertHasSizeLessThanOrEqualTo(AssertionInfo info, Iterable<?> actual, int boundary) Asserts that the number of elements in the givenIterableis less than or equal to the boundary.<E> voidassertHave(AssertionInfo info, Iterable<? extends E> actual, Condition<? super E> condition) Assert that each element of givenIterablesatisfies the given condition.<E> voidassertHaveAtLeast(AssertionInfo info, Iterable<? extends E> actual, int times, Condition<? super E> condition) An alias method ofassertAreAtLeast(AssertionInfo, Iterable, int, Condition)to provide a richer fluent api (same logic, only error message differs).<E> voidassertHaveAtMost(AssertionInfo info, Iterable<? extends E> actual, int times, Condition<? super E> condition) An alias method ofassertAreAtMost(AssertionInfo, Iterable, int, Condition)to provide a richer fluent api (same logic, only error message differs).<E> voidassertHaveExactly(AssertionInfo info, Iterable<? extends E> actual, int times, Condition<? super E> condition) An alias method ofassertAreExactly(AssertionInfo, Iterable, int, Condition)to provide a richer fluent api (same logic, only error message differs).voidassertIsSubsetOf(AssertionInfo info, Iterable<?> actual, Iterable<?> values) Verifies that the actualIterableis a subset of valuesIterable.<E> voidassertNoneMatch(AssertionInfo info, Iterable<? extends E> actual, Predicate<? super E> predicate, PredicateDescription predicateDescription) <E> voidassertNoneSatisfy(AssertionInfo info, Iterable<? extends E> actual, Consumer<? super E> restrictions) voidassertNotEmpty(AssertionInfo info, Iterable<?> actual) Asserts that the givenIterableis not empty.voidassertNullOrEmpty(AssertionInfo info, Iterable<?> actual) Asserts that the givenisIterablenullor empty.<E> voidassertSatisfiesExactly(AssertionInfo info, Iterable<? extends E> actual, Consumer<? super E>[] allRequirements) <E> voidassertSatisfiesExactlyInAnyOrder(AssertionInfo info, Iterable<? extends E> actual, Consumer<? super E>[] consumers) <E> voidassertSatisfiesOnlyOnce(AssertionInfo info, Iterable<? extends E> actual, Consumer<? super E> requirements) voidassertStartsWith(AssertionInfo info, Iterable<?> actual, Object[] sequence) Verifies that the givenIterablestarts with the given sequence of objects, without any other objects between them.<ACTUAL_ELEMENT,OTHER_ELEMENT>
voidassertZipSatisfy(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<?> static Iterablesinstance()Returns the singleton instance of this class based onStandardComparisonStrategy.
-
Constructor Details
-
Iterables
-
-
Method Details
-
instance
Returns the singleton instance of this class based onStandardComparisonStrategy.- Returns:
- the singleton instance of this class based on
StandardComparisonStrategy.
-
getComparator
-
getComparisonStrategy
-
assertNullOrEmpty
Asserts that the givenisIterablenullor empty.- Parameters:
info- contains information about the assertion.actual- the givenIterable.- Throws:
AssertionError- if the givenIterableis notnull*and* contains one or more elements.
-
assertEmpty
Asserts that the givenIterableis empty.- Parameters:
info- contains information about the assertion.actual- the givenIterable.- Throws:
AssertionError- if the givenIterableisnull.AssertionError- if the givenIterableis not empty.
-
assertNotEmpty
Asserts that the givenIterableis not empty.- Parameters:
info- contains information about the assertion.actual- the givenIterable.- Throws:
AssertionError- if the givenIterableisnull.AssertionError- if the givenIterableis empty.
-
assertHasSize
Asserts that the number of elements in the givenIterableis equal to the expected one.- Parameters:
info- contains information about the assertion.actual- the givenIterable.expectedSize- the expected size ofactual.- Throws:
AssertionError- if the givenIterableisnull.AssertionError- if the number of elements in the givenIterableis different from the expected one.
-
assertHasOnlyOneElementSatisfying
public <T> void assertHasOnlyOneElementSatisfying(AssertionInfo info, Iterable<? extends T> actual, Consumer<? super T> consumer) Asserts that the unique element of theIterablesatisfies the given assertions expressed as aConsumer,- Type Parameters:
T- the type of elements in actual.- Parameters:
info- contains information about the assertion.actual- the givenIterable.consumer- the given requirements.- Throws:
AssertionError- if theIterabledoes not have a unique element.AssertionError- if theIterable's unique element does not satisfies the given assertions.
-
assertHasSizeGreaterThan
Asserts that the number of elements in the givenIterableis greater than the boundary.- Parameters:
info- contains information about the assertion.actual- the givenIterable.boundary- the given value to compare the size ofactualto.- Throws:
AssertionError- if the givenIterableisnull.AssertionError- if the number of elements in the givenIterableis greater than the boundary.
-
assertHasSizeGreaterThanOrEqualTo
Asserts that the number of elements in the givenIterableis greater than or equal to the boundary.- Parameters:
info- contains information about the assertion.actual- the givenIterable.boundary- the given value to compare the size ofactualto.- Throws:
AssertionError- if the givenIterableisnull.AssertionError- if the number of elements in the givenIterableis greater than or equal to the boundary.
-
assertHasSizeLessThan
Asserts that the number of elements in the givenIterableis less than the boundary.- Parameters:
info- contains information about the assertion.actual- the givenIterable.boundary- the given value to compare the size ofactualto.- Throws:
AssertionError- if the givenIterableisnull.AssertionError- if the number of elements in the givenIterableis less than the expected one.
-
assertHasSizeLessThanOrEqualTo
Asserts that the number of elements in the givenIterableis less than or equal to the boundary.- Parameters:
info- contains information about the assertion.actual- the givenIterable.boundary- the given value to compare the size ofactualto.- Throws:
AssertionError- if the givenIterableisnull.AssertionError- if the number of elements in the givenIterableis less than or equal to the boundary.
-
assertHasSizeBetween
public void assertHasSizeBetween(AssertionInfo info, Iterable<?> actual, int lowerBoundary, int higherBoundary) Asserts that the number of elements in the givenIterableis between the given lower and higher boundary (inclusive).- Parameters:
info- contains information about the assertion.actual- the givenIterable.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.- Throws:
AssertionError- if the given array isnull.AssertionError- if the number of elements in the given array is not between the boundaries.
-
assertHasSameSizeAs
Assert that the actualIterablehas the same size as the other array.- Parameters:
info- contains information about the assertion.actual- the givenIterable.other- the given array to compare.- Throws:
AssertionError- if the actual group isnull.AssertionError- if the other group isnull.AssertionError- if actualIterableand other array don't have the same size.
-
assertHasSameSizeAs
Assert that the actualIterablehas the same size as the otherIterable.- Parameters:
info- contains information about the assertion.actual- the givenIterable.other- the givenIterable.- Throws:
AssertionError- if the actual group isnull.AssertionError- if the other group isnull.AssertionError- if actual and otherIterabledon't have the same size.
-
assertContains
Asserts that the givenIterablecontains the given values, in any order.- Parameters:
info- contains information about the assertion.actual- the givenIterable.values- the values that are expected to be in the givenIterable.- Throws:
NullPointerException- if the array of values isnull.IllegalArgumentException- if the array of values is empty.AssertionError- if the givenIterableisnull.AssertionError- if the givenIterabledoes not contain the given values.
-
assertContainsOnly
Asserts that the givenIterablecontains only the given values and nothing else, in any order.- Parameters:
info- contains information about the assertion.actual- the givenIterable.expectedValues- the values that are expected to be in the givenIterable.- Throws:
NullPointerException- if the array of values isnull.IllegalArgumentException- if the array of values is empty.AssertionError- if the givenIterableisnull.AssertionError- if the givenIterabledoes not contain the given values or if the givenIterablecontains values that are not in the given array.
-
assertContainsOnlyOnce
Asserts that the givenIterablecontains the given values and only once.- Parameters:
info- contains information about the assertion.actual- the givenIterable.values- the values that are expected to be in the givenIterable.- Throws:
NullPointerException- if the array of values isnull.IllegalArgumentException- if the array of values is empty.AssertionError- if the givenIterableisnull.AssertionError- if the givenIterabledoes not contain the given values or if the givenIterablecontains values that are not in the given array.
-
assertContainsOnlyNulls
Asserts that the givenIterablecontains only null elements and nothing else.- Parameters:
info- contains information about the assertion.actual- the givenIterable.- Throws:
AssertionError- if the givenIterableisnull.AssertionError- if the givenIterabledoes not contain at least a null element or if the givenIterablecontains values that are not null elements.
-
assertContainsSequence
Verifies that the givencontains the given sequence of objects, without any other objects between them.Iterable- Parameters:
info- contains information about the assertion.actual- the givenIterable.sequence- the sequence of objects to look for.- Throws:
AssertionError- if the givenIterableisnull.NullPointerException- if the given sequence isnull.IllegalArgumentException- if the given sequence is empty.AssertionError- if the givenIterabledoes not contain the given sequence of objects.
-
assertDoesNotContainSequence
Verifies that the givendoes not contain the given sequence of objects in order.Iterable- Parameters:
info- contains information about the assertion.actual- the givenIterable.sequence- the sequence of objects to look for.- Throws:
AssertionError- if the givenIterableisnull.NullPointerException- if the given sequence isnull.IllegalArgumentException- if the given sequence is empty.AssertionError- if the givenIterabledoes contain the given sequence of objects.
-
assertContainsSubsequence
Verifies that the givencontains the given subsequence of objects (possibly with other values between them).Iterable- Parameters:
info- contains information about the assertion.actual- the givenIterable.subsequence- the subsequence of objects to look for.- Throws:
AssertionError- if the givenIterableisnull.NullPointerException- if the given sequence isnull.IllegalArgumentException- if the given subsequence is empty.AssertionError- if the givenIterabledoes not contain the given subsequence of objects.
-
assertDoesNotContainSubsequence
public void assertDoesNotContainSubsequence(AssertionInfo info, Iterable<?> actual, Object[] subsequence) Verifies that the givendoes not contain the given subsequence of objects (possibly with other values between them).Iterable- Parameters:
info- contains information about the assertion.actual- the givenIterable.subsequence- the subsequence of objects to look for.- Throws:
AssertionError- if the givenIterableisnull.NullPointerException- if the given sequence isnull.IllegalArgumentException- if the given subsequence is empty.AssertionError- if the givenIterablecontains the given subsequence of objects.
-
assertIsSubsetOf
Verifies that the actualIterableis a subset of valuesIterable.
Both actual and given iterable are treated as sets, therefore duplicates on either of them are ignored.- Parameters:
info- contains information about the assertion.actual- the actualIterable.values- theIterablethat should contain all actual elements.- Throws:
AssertionError- if the actualIterableisnull.NullPointerException- if the given Iterable isnull.AssertionError- if the actualIterableis not subset of setIterable
-
assertDoesNotContain
Asserts that the givenIterabledoes not contain the given values.- Parameters:
info- contains information about the assertion.actual- the givenIterable.values- the values that are expected not to be in the givenIterable.- Throws:
NullPointerException- if the array of values isnull.IllegalArgumentException- if the array of values is empty.AssertionError- if the givenIterableisnull.AssertionError- if the givenIterablecontains any of given values.
-
assertDoesNotContainAnyElementsOf
public <T> void assertDoesNotContainAnyElementsOf(AssertionInfo info, Iterable<? extends T> actual, Iterable<? extends T> iterable) Asserts that the givenIterabledoes not contain the given values.- Type Parameters:
T- the type of actual elements- Parameters:
info- contains information about the assertion.actual- the givenIterable.iterable- the values that are expected not to be in the givenIterable.- Throws:
NullPointerException- if the array of values isnull.IllegalArgumentException- if the array of values is empty.AssertionError- if the givenIterableisnull.AssertionError- if the givenIterablecontains any of given values.
-
assertDoesNotHaveDuplicates
Asserts that the givenIterabledoes not have duplicate values.- Parameters:
info- contains information about the assertion.actual- the givenIterable.- Throws:
NullPointerException- if the array of values isnull.IllegalArgumentException- if the array of values is empty.AssertionError- if the givenIterableisnull.AssertionError- if the givenIterablecontains duplicate values.
-
assertStartsWith
Verifies that the givenIterablestarts with the given sequence of objects, without any other objects between them. Similar to, but it also verifies that the first element in the sequence is also the first element of the givenassertContainsSequence(AssertionInfo, Iterable, Object[])Iterable.- Parameters:
info- contains information about the assertion.actual- the givenIterable.sequence- the sequence of objects to look for.- Throws:
NullPointerException- if the given argument isnull.IllegalArgumentException- if the given argument is an empty array.AssertionError- if the givenIterableisnull.AssertionError- if the givenIterabledoes not start with the given sequence of objects.
-
assertEndsWith
Verifies that the givenIterableends with the given sequence of objects, without any other objects between them. Similar to, but it also verifies that the last element in the sequence is also the last element of the givenassertContainsSequence(AssertionInfo, Iterable, Object[])Iterable.- Parameters:
info- contains information about the assertion.actual- the givenIterable.first- the first element of the end sequence.rest- the optional next elements of the end sequence.- Throws:
NullPointerException- if the given argument isnull.IllegalArgumentException- if the given argument is an empty array.AssertionError- if the givenIterableisnull.AssertionError- if the givenIterabledoes not end with the given sequence of objects.
-
assertEndsWith
Verifies that the givenIterableends with the given sequence of objects, without any other objects between them. Similar to, but it also verifies that the last element in the sequence is also the last element of the givenassertContainsSequence(AssertionInfo, Iterable, Object[])Iterable.- Parameters:
info- contains information about the assertion.actual- the givenIterable.sequence- the sequence of objects to look for.- Throws:
NullPointerException- if the given argument isnull.IllegalArgumentException- if the given argument is an empty array.AssertionError- if the givenIterableisnull.AssertionError- if the givenIterabledoes not end with the given sequence of objects.
-
assertContainsNull
Asserts that the givenIterablecontains at least a null element.- Parameters:
info- contains information about the assertion.actual- the givenIterable.- Throws:
AssertionError- if the givenIterableisnull.AssertionError- if the givenIterabledoes not contain at least a null element.
-
assertDoesNotContainNull
Asserts that the givenIterabledoes not contain null elements.- Parameters:
info- contains information about the assertion.actual- the givenIterable.- Throws:
AssertionError- if the givenIterableisnull.AssertionError- if the givenIterablecontains a null element.
-
assertAre
public <T> void assertAre(AssertionInfo info, Iterable<? extends T> actual, Condition<? super T> condition) Assert that each element of givenIterablesatisfies the given condition.- Type Parameters:
T- the type of actual elements- Parameters:
info- contains information about the assertion.actual- the givenIterable.condition- the givenCondition.- Throws:
NullPointerException- if the given condition isnull.AssertionError- if an element cannot be cast to T.AssertionError- if one or more elements do not satisfy the given condition.
-
assertAreNot
public <E> void assertAreNot(AssertionInfo info, Iterable<? extends E> actual, Condition<? super E> condition) Assert that each element of givenIterablenot satisfies the given condition.- Type Parameters:
E- the type of actual elements- Parameters:
info- contains information about the assertion.actual- the givenIterable.condition- the givenCondition.- Throws:
NullPointerException- if the given condition isnull.AssertionError- if an element cannot be cast to E.AssertionError- if one or more elements satisfy the given condition.
-
assertHave
public <E> void assertHave(AssertionInfo info, Iterable<? extends E> actual, Condition<? super E> condition) Assert that each element of givenIterablesatisfies the given condition.- Type Parameters:
E- the type of actual elements- Parameters:
info- contains information about the assertion.actual- the givenIterable.condition- the givenCondition.- Throws:
NullPointerException- if the given condition isnull.AssertionError- if an element cannot be cast to E.AssertionError- if one or more elements do not satisfy the given condition.
-
assertDoNotHave
public <E> void assertDoNotHave(AssertionInfo info, Iterable<? extends E> actual, Condition<? super E> condition) Assert that each element of givenIterablenot satisfies the given condition.- Type Parameters:
E- the type of actual elements- Parameters:
info- contains information about the assertion.actual- the givenIterable.condition- the givenCondition.- Throws:
NullPointerException- if the given condition isnull.AssertionError- if an element cannot be cast to E.AssertionError- if one or more elements satisfy the given condition.
-
assertAreAtLeast
public <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 actualIterablesatisfying the given condition.- Type Parameters:
E- the type of actual elements- Parameters:
info- contains information about the assertion.actual- the givenIterable.times- the minimum number of times the condition should be verified.condition- the givenCondition.- Throws:
NullPointerException- if the given condition isnull.AssertionError- if an element cannot be cast to E.AssertionError- if the number of elements satisfying the given condition is < n.
-
assertAreAtMost
public <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 actualIterablesatisfying the given condition.- Type Parameters:
E- the type of actual elements- Parameters:
info- contains information about the assertion.actual- the givenIterable.n- the number of times the condition should be at most verified.condition- the givenCondition.- Throws:
NullPointerException- if the given condition isnull.AssertionError- if an element cannot be cast to E.AssertionError- if the number of elements satisfying the given condition is > n.
-
assertAreExactly
public <E> void assertAreExactly(AssertionInfo info, Iterable<? extends E> actual, int times, Condition<? super E> condition) Verifies that there are exactly n elements in the actualIterablesatisfying the given condition.- Type Parameters:
E- the type of actual elements- Parameters:
info- contains information about the assertion.actual- the givenIterable.times- the exact number of times the condition should be verified.condition- the givenCondition.- Throws:
NullPointerException- if the given condition isnull.AssertionError- if an element cannot be cast to E.AssertionError- if the number of elements satisfying the given condition is ≠ n.
-
assertHaveAtLeast
public <E> void assertHaveAtLeast(AssertionInfo info, Iterable<? extends E> actual, int times, Condition<? super E> condition) An alias method ofassertAreAtLeast(AssertionInfo, Iterable, int, Condition)to provide a richer fluent api (same logic, only error message differs).- Type Parameters:
E- the type of actual elements- Parameters:
info- contains information about the assertion.actual- the givenIterable.times- the minimum number of times the condition should be verified.condition- the givenCondition.- Throws:
NullPointerException- if the given condition isnull.AssertionError- if an element cannot be cast to E.AssertionError- if the number of elements satisfying the given condition is < n.
-
assertHaveAtMost
public <E> void assertHaveAtMost(AssertionInfo info, Iterable<? extends E> actual, int times, Condition<? super E> condition) An alias method ofassertAreAtMost(AssertionInfo, Iterable, int, Condition)to provide a richer fluent api (same logic, only error message differs).- Type Parameters:
E- the type of actual elements- Parameters:
info- contains information about the assertion.actual- the givenIterable.times- the number of times the condition should be at most verified.condition- the givenCondition.- Throws:
NullPointerException- if the given condition isnull.AssertionError- if an element cannot be cast to E.AssertionError- if the number of elements satisfying the given condition is > n.
-
assertHaveExactly
public <E> void assertHaveExactly(AssertionInfo info, Iterable<? extends E> actual, int times, Condition<? super E> condition) An alias method ofassertAreExactly(AssertionInfo, Iterable, int, Condition)to provide a richer fluent api (same logic, only error message differs).- Type Parameters:
E- the type of actual elements- Parameters:
info- contains information about the assertion.actual- the givenIterable.times- the exact number of times the condition should be verified.condition- the givenCondition.- Throws:
NullPointerException- if the given condition isnull.AssertionError- if an element cannot be cast to E.AssertionError- if the number of elements satisfying the given condition is ≠ n.
-
assertContainsAll
Asserts that the givenIterablecontains all the elements of the otherIterable, in any order.- Parameters:
info- contains information about the assertion.actual- the givenIterable.other- the otherIterable.- Throws:
NullPointerException- ifIterableisnull.AssertionError- if the givenIterableisnull.AssertionError- if the givenIterabledoes not contain all the elements of the otherIterable, in any order.
-
assertContainsExactly
Asserts that the givenIterablecontains exactly the given values and nothing else, in order.- Parameters:
info- contains information about the assertion.actual- the givenIterable.values- the values that are expected to be in the givenIterablein order.- Throws:
NullPointerException- if the array of values isnull.AssertionError- if the givenIterableisnull.AssertionError- if the givenIterabledoes not contain the given values or if the givenIterablecontains values that are not in the given array, in order.
-
assertAllSatisfy
public <E> void assertAllSatisfy(AssertionInfo info, Iterable<? extends E> actual, Consumer<? super E> requirements) -
assertSatisfiesExactly
public <E> void assertSatisfiesExactly(AssertionInfo info, Iterable<? extends E> actual, Consumer<? super E>[] allRequirements) -
assertSatisfiesExactlyInAnyOrder
public <E> void assertSatisfiesExactlyInAnyOrder(AssertionInfo info, Iterable<? extends E> actual, Consumer<? super E>[] consumers) -
assertSatisfiesOnlyOnce
public <E> void assertSatisfiesOnlyOnce(AssertionInfo info, Iterable<? extends E> actual, Consumer<? super E> requirements) -
assertZipSatisfy
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) -
assertAnySatisfy
public <E> void assertAnySatisfy(AssertionInfo info, Iterable<? extends E> actual, Consumer<? super E> requirements) -
assertAllMatch
public <E> void assertAllMatch(AssertionInfo info, Iterable<? extends E> actual, Predicate<? super E> predicate, PredicateDescription predicateDescription) -
assertNoneSatisfy
public <E> void assertNoneSatisfy(AssertionInfo info, Iterable<? extends E> actual, Consumer<? super E> restrictions) -
assertAnyMatch
public <E> void assertAnyMatch(AssertionInfo info, Iterable<? extends E> actual, Predicate<? super E> predicate, PredicateDescription predicateDescription) -
assertNoneMatch
public <E> void assertNoneMatch(AssertionInfo info, Iterable<? extends E> actual, Predicate<? super E> predicate, PredicateDescription predicateDescription) -
assertContainsAnyOf
Asserts that the givenIterablecontains at least one of the givenvalues.- Parameters:
info- contains information about the assertion.actual- the givenIterable.values- the values that, at least one of which is expected to be in the givenIterable.- Throws:
NullPointerException- if the array of values isnull.IllegalArgumentException- if the array of values is empty and givenIterableis not empty.AssertionError- if the givenIterableisnull.AssertionError- if the givenIterabledoes not contain any of givenvalues.
-
assertContainsExactlyInAnyOrder
public void assertContainsExactlyInAnyOrder(AssertionInfo info, Iterable<?> actual, Object[] values) -
byPassingAssertions
-