public class ObjectArrays extends Object
| Constructor and Description |
|---|
ObjectArrays(ComparisonStrategy comparisonStrategy) |
| Modifier and Type | Method and Description |
|---|---|
<E> void |
assertAre(AssertionInfo info,
E[] actual,
Condition<? super E> condition)
Assert that each element of given array satisfies the given condition.
|
<E> void |
assertAreAtLeast(AssertionInfo info,
E[] actual,
int n,
Condition<? super E> condition)
Assert that there is at least n array elements satisfying the given condition.
|
<E> void |
assertAreAtMost(AssertionInfo info,
E[] actual,
int n,
Condition<? super E> condition)
Assert that there is at most n array elements satisfying the given condition.
|
<E> void |
assertAreExactly(AssertionInfo info,
E[] actual,
int n,
Condition<? super E> condition)
Verifies that there is exactly n array elements satisfying the given condition.
|
<E> void |
assertAreNot(AssertionInfo info,
E[] actual,
Condition<? super E> condition)
Assert that each element of given array not satisfies the given condition.
|
void |
assertContains(AssertionInfo info,
Object[] actual,
Object[] values)
Asserts that the given array contains the given values, in any order.
|
void |
assertContains(AssertionInfo info,
Object[] actual,
Object value,
Index index)
Verifies that the given array contains the given object at the given index.
|
<E> void |
assertContainsAll(AssertionInfo info,
E[] actual,
Iterable<? extends E> other)
Asserts that the given array contains all the elements of the given
Iterable, in any order. |
void |
assertContainsExactly(AssertionInfo info,
Object[] actual,
Object[] values) |
void |
assertContainsExactlyInAnyOrder(AssertionInfo info,
Object[] actual,
Object[] values) |
void |
assertContainsNull(AssertionInfo info,
Object[] actual)
Asserts that the given array contains at least a null element.
|
void |
assertContainsOnly(AssertionInfo info,
Object[] actual,
Object[] values)
Asserts that the given array contains only the given values and nothing else, in any order.
|
void |
assertContainsOnlyOnce(AssertionInfo info,
Object[] actual,
Object[] values)
Asserts that the given array contains only once the given values.
|
void |
assertContainsSequence(AssertionInfo info,
Object[] actual,
Object[] sequence)
Verifies that the given array contains the given sequence of objects, without any other objects between them.
|
void |
assertContainsSubsequence(AssertionInfo info,
Object[] actual,
Object[] subsequence)
Verifies that the given array contains the given subsequence of objects (possibly with other values between them).
|
void |
assertDoesNotContain(AssertionInfo info,
Object[] actual,
Object[] values)
Asserts that the given array does not contain the given values.
|
void |
assertDoesNotContain(AssertionInfo info,
Object[] actual,
Object value,
Index index)
Verifies that the given array does not contain the given object at the given index.
|
<T> void |
assertDoesNotContainAnyElementsOf(AssertionInfo info,
Object[] actual,
Iterable<? extends T> iterable) |
void |
assertDoesNotContainNull(AssertionInfo info,
Object[] actual)
Asserts that the given array does not contain null elements.
|
void |
assertDoesNotHaveDuplicates(AssertionInfo info,
Object[] actual)
Asserts that the given array does not have duplicate values.
|
<E> void |
assertDoNotHave(AssertionInfo info,
E[] actual,
Condition<? super E> condition)
Assert that each element of given array not satisfies the given condition.
|
void |
assertEmpty(AssertionInfo info,
Object[] actual)
Asserts that the given array is empty.
|
void |
assertEndsWith(AssertionInfo info,
Object[] actual,
Object[] sequence)
Verifies that the given array ends with the given sequence of objects, without any other objects between them.
|
<E> void |
assertHasAtLeastOneElementOfType(AssertionInfo info,
E[] actual,
Class<?> type) |
<E> void |
assertHasOnlyElementsOfType(AssertionInfo info,
E[] actual,
Class<?> type) |
void |
assertHasSameSizeAs(AssertionInfo info,
Object[] actual,
Iterable<?> other)
Assert that the actual array has the same size as the other
Iterable. |
void |
assertHasSameSizeAs(AssertionInfo info,
Object[] actual,
Object other)
Assert that the actual array has the same size as the other array.
|
void |
assertHasSize(AssertionInfo info,
Object[] actual,
int expectedSize)
Asserts that the number of elements in the given array is equal to the expected one.
|
<E> void |
assertHave(AssertionInfo info,
E[] actual,
Condition<? super E> condition)
Assert that each element of given array satisfies the given condition.
|
<E> void |
assertHaveAtLeast(AssertionInfo info,
E[] actual,
int times,
Condition<? super E> condition)
An alias method of
assertAreAtLeast(AssertionInfo, Object[], int, Condition) to provide a richer fluent
api (same logic, only error message differs). |
<E> void |
assertHaveAtMost(AssertionInfo info,
E[] actual,
int times,
Condition<? super E> condition)
An alias method of
assertAreAtMost(AssertionInfo, Object[], int, Condition) to provide a richer fluent api
(same logic, only error message differs). |
<E> void |
assertHaveExactly(AssertionInfo info,
E[] actual,
int times,
Condition<? super E> condition)
An alias method of
assertAreExactly(AssertionInfo, Object[], int, Condition) to provide a richer fluent
api (same logic, only error message differs). |
void |
assertIsSorted(AssertionInfo info,
Object[] actual)
Concrete implementation of
ArraySortedAssert.isSorted(). |
<E> void |
assertIsSortedAccordingToComparator(AssertionInfo info,
E[] actual,
Comparator<? super E> comparator)
Concrete implementation of
ArraySortedAssert.isSortedAccordingTo(Comparator). |
void |
assertIsSubsetOf(AssertionInfo info,
Object actual,
Iterable<?> values) |
void |
assertNotEmpty(AssertionInfo info,
Object[] actual)
Asserts that the given array is not empty.
|
void |
assertNullOrEmpty(AssertionInfo info,
Object[] actual)
Asserts that the given array is
null or empty. |
void |
assertStartsWith(AssertionInfo info,
Object[] actual,
Object[] sequence)
Verifies that the given array starts with the given sequence of objects, without any other objects between them.
|
Comparator<?> |
getComparator() |
ComparisonStrategy |
getComparisonStrategy() |
static ObjectArrays |
instance()
Returns the singleton instance of this class.
|
public ObjectArrays(ComparisonStrategy comparisonStrategy)
public static ObjectArrays instance()
public Comparator<?> getComparator()
public ComparisonStrategy getComparisonStrategy()
public void assertNullOrEmpty(AssertionInfo info, Object[] actual)
null or empty.info - contains information about the assertion.actual - the given array.AssertionError - if the given array is not null *and* contains one or more elements.public void assertEmpty(AssertionInfo info, Object[] actual)
info - contains information about the assertion.actual - the given array.AssertionError - if the given array is null.AssertionError - if the given array is not empty.public void assertNotEmpty(AssertionInfo info, Object[] actual)
info - contains information about the assertion.actual - the given array.AssertionError - if the given array is null.AssertionError - if the given array is empty.public void assertHasSize(AssertionInfo info, Object[] actual, int expectedSize)
info - contains information about the assertion.actual - the given array.expectedSize - the expected size of actual.AssertionError - if the given array is null.AssertionError - if the number of elements in the given array is different than the expected one.public void assertHasSameSizeAs(AssertionInfo info, Object[] actual, Iterable<?> other)
Iterable.info - contains information about the assertion.actual - the given iterable.other - the group to compareAssertionError - if the actual group is null.AssertionError - if the other group is null.AssertionError - if the actual group does not have the same size.public void assertHasSameSizeAs(AssertionInfo info, Object[] actual, Object other)
info - contains information about the assertion.actual - the given array.other - the group to compareAssertionError - if the actual group is null.AssertionError - if the other group is null.AssertionError - if the actual group does not have the same size.public void assertContains(AssertionInfo info, Object[] actual, Object[] values)
info - contains information about the assertion.actual - the given array.values - the values that are expected to be in the given array.NullPointerException - if the array of values is null.IllegalArgumentException - if the array of values is empty.AssertionError - if the given array is null.AssertionError - if the given array does not contain the given values.public void assertContains(AssertionInfo info, Object[] actual, Object value, Index index)
info - contains information about the assertion.actual - the given array.value - the object to look for.index - the index where the object should be stored in the given array.AssertionError - if the given array is null or empty.NullPointerException - if the given Index is null.IndexOutOfBoundsException - if the value of the given Index is equal to or greater than the size of
the given array.AssertionError - if the given array does not contain the given object at the given index.public void assertDoesNotContain(AssertionInfo info, Object[] actual, Object value, Index index)
info - contains information about the assertion.actual - the given array.value - the object to look for.index - the index where the object should be stored in the given array.AssertionError - if the given array is null.NullPointerException - if the given Index is null.AssertionError - if the given array contains the given object at the given index.public void assertContainsOnly(AssertionInfo info, Object[] actual, Object[] values)
info - contains information about the assertion.actual - the given array.values - the values that are expected to be in the given array.NullPointerException - if the array of values is null.IllegalArgumentException - if the array of values is empty.AssertionError - if the given array is null.AssertionError - if the given array does not contain the given values or if the given array contains values
that are not in the given array.public void assertContainsExactly(AssertionInfo info, Object[] actual, Object[] values)
public void assertContainsExactlyInAnyOrder(AssertionInfo info, Object[] actual, Object[] values)
public void assertContainsOnlyOnce(AssertionInfo info, Object[] actual, Object[] values)
info - contains information about the assertion.actual - the given array.values - the values that are expected to be in the given array.NullPointerException - if the array of values is null.IllegalArgumentException - if the array of values is empty.AssertionError - if the given array is null.AssertionError - if the given array does not contain the given values or if the given array contains values
that are not in the given array.public void assertContainsSequence(AssertionInfo info, Object[] actual, Object[] sequence)
info - contains information about the assertion.actual - the given array.sequence - the sequence of objects to look for.AssertionError - if the given array is null.NullPointerException - if the given sequence is null.IllegalArgumentException - if the given sequence is empty.AssertionError - if the given array does not contain the given sequence of objects.public void assertContainsSubsequence(AssertionInfo info, Object[] actual, Object[] subsequence)
info - contains information about the assertion.actual - the given array.subsequence - the subsequence of objects to look for.AssertionError - if the given array is null.NullPointerException - if the given subsequence is null.IllegalArgumentException - if the given subsequence is empty.AssertionError - if the given array does not contain the given subsequence of objects.public void assertDoesNotContain(AssertionInfo info, Object[] actual, Object[] values)
info - contains information about the assertion.actual - the given array.values - the values that are expected not to be in the given array.NullPointerException - if the array of values is null.IllegalArgumentException - if the array of values is empty.AssertionError - if the given array is null.AssertionError - if the given array contains any of given values.public <T> void assertDoesNotContainAnyElementsOf(AssertionInfo info, Object[] actual, Iterable<? extends T> iterable)
public void assertDoesNotHaveDuplicates(AssertionInfo info, Object[] actual)
info - contains information about the assertion.actual - the given array.NullPointerException - if the array of values is null.IllegalArgumentException - if the array of values is empty.AssertionError - if the given array is null.AssertionError - if the given array contains duplicate values.public void assertStartsWith(AssertionInfo info, Object[] actual, Object[] sequence)
assertContainsSequence(AssertionInfo, Object[], Object[]), but it also verifies
that the first element in the sequence is also the first element of the given array.info - contains information about the assertion.actual - the given array.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 array is null.AssertionError - if the given array does not start with the given sequence of objects.public void assertEndsWith(AssertionInfo info, Object[] actual, Object[] sequence)
assertContainsSequence(AssertionInfo, Object[], Object[]), but it also verifies
that the last element in the sequence is also the last element of the given array.info - contains information about the assertion.actual - the given array.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 array is null.AssertionError - if the given array does not end with the given sequence of objects.public void assertIsSubsetOf(AssertionInfo info, Object actual, Iterable<?> values)
public void assertContainsNull(AssertionInfo info, Object[] actual)
info - contains information about the assertion.actual - the given array.AssertionError - if the given array is null.AssertionError - if the given array does not contain a null element.public void assertDoesNotContainNull(AssertionInfo info, Object[] actual)
info - contains information about the assertion.actual - the given array.AssertionError - if the given array is null.AssertionError - if the given array contains a null element.public <E> void assertAre(AssertionInfo info, E[] actual, Condition<? super E> condition)
info - contains information about the assertion.actual - the given array.condition - the given Condition.NullPointerException - if the given condition is null.AssertionError - if one or more elements do not satisfy the given condition.public <E> void assertAreNot(AssertionInfo info, E[] actual, Condition<? super E> condition)
info - contains information about the assertion.actual - the given array.condition - the given Condition.NullPointerException - if the given condition is null.AssertionError - if one or more elements satisfy the given condition.public <E> void assertHave(AssertionInfo info, E[] actual, Condition<? super E> condition)
info - contains information about the assertion.actual - the given array.condition - the given Condition.NullPointerException - if the given condition is null.AssertionError - if one or more elements do not satisfy the given condition.public <E> void assertDoNotHave(AssertionInfo info, E[] actual, Condition<? super E> condition)
info - contains information about the assertion.actual - the given array.condition - the given Condition.NullPointerException - if the given condition is null.AssertionError - if one or more elements satisfy the given condition.public <E> void assertAreAtLeast(AssertionInfo info, E[] actual, int n, Condition<? super E> condition)
info - contains information about the assertion.actual - the given array.n - the minimum number of times the condition should be verified.condition - the given Condition.NullPointerException - if the given condition is null.AssertionError - if the number of elements satisfying the given condition is < n.public <E> void assertAreAtMost(AssertionInfo info, E[] actual, int n, Condition<? super E> condition)
info - contains information about the assertion.actual - the given array.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 the number of elements satisfying the given condition is > n.public <E> void assertAreExactly(AssertionInfo info, E[] actual, int n, Condition<? super E> condition)
info - contains information about the assertion.actual - the given array.n - the exact number of times the condition should be verified.condition - the given Condition.NullPointerException - if the given condition is null.AssertionError - if the number of elements satisfying the given condition is ≠ n.public <E> void assertHaveAtLeast(AssertionInfo info, E[] actual, int times, Condition<? super E> condition)
assertAreAtLeast(AssertionInfo, Object[], int, Condition) to provide a richer fluent
api (same logic, only error message differs).public <E> void assertHaveAtMost(AssertionInfo info, E[] actual, int times, Condition<? super E> condition)
assertAreAtMost(AssertionInfo, Object[], int, Condition) to provide a richer fluent api
(same logic, only error message differs).public <E> void assertHaveExactly(AssertionInfo info, E[] actual, int times, Condition<? super E> condition)
assertAreExactly(AssertionInfo, Object[], int, Condition) to provide a richer fluent
api (same logic, only error message differs).public <E> void assertHasAtLeastOneElementOfType(AssertionInfo info, E[] actual, Class<?> type)
public <E> void assertHasOnlyElementsOfType(AssertionInfo info, E[] actual, Class<?> type)
public void assertIsSorted(AssertionInfo info, Object[] actual)
ArraySortedAssert.isSorted().info - contains information about the assertion.actual - the given array.public <E> void assertIsSortedAccordingToComparator(AssertionInfo info, E[] actual, Comparator<? super E> comparator)
ArraySortedAssert.isSortedAccordingTo(Comparator).info - contains information about the assertion.actual - the given array.comparator - the Comparator used to compare array elementspublic <E> void assertContainsAll(AssertionInfo info, E[] actual, Iterable<? extends E> other)
Iterable, in any order.info - contains information about the assertion.actual - the given array.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.Copyright © 2014–2016 AssertJ. All rights reserved.