Top Description Fields Constructors Methods
org.assertj.core.internal

public Class ObjectArrays

extends Object
Class Inheritance
Static Imports
java.util.stream.Collectors.toList, org.assertj.core.error.ShouldHaveAtLeastOneElementOfType.shouldHaveAtLeastOneElementOfType, .ShouldHaveExactlyTypes.elementsTypesDifferAtIndex, .ShouldHaveExactlyTypes.shouldHaveTypes, .ShouldHaveOnlyElementsOfType.shouldHaveOnlyElementsOfType, .ShouldNotHaveAnyElementsOfTypes.shouldNotHaveAnyElementsOfTypes, org.assertj.core.internal.CommonValidations.checkIsNotNullAndNotEmpty, .IterableDiff.diff, org.assertj.core.util.Lists.list, .Lists.newArrayList

Reusable assertions for arrays of objects.
Authors
Alex Ruiz, Joel Costigliola, Nicolas François, Mikhail Mazursky

Field Summary

Modifier and TypeField and Description
private Arrays
pack-priv Conditions
pack-priv Failures
private static final ObjectArrays

Constructor Summary

AccessConstructor and Description
pack-priv
public
ObjectArrays(ComparisonStrategy comparisonStrategy)

Method Summary

Modifier and TypeMethod and Description
public <
element type
E
>
void
assertAre(AssertionInfo
contains information about the assertion.
info
,
E[]
the given array.
actual
,
Condition<? super E>
the given Condition.
condition
)

Assert that each element of given array satisfies the given condition.

public <
element type
E
>
void
assertAreAtLeast(AssertionInfo
contains information about the assertion.
info
,
E[]
the given array.
actual
,
int
the minimum number of times the condition should be verified.
n
,
Condition<? super E>
the given Condition.
condition
)

Assert that there are at least n array elements satisfying the given condition.

public <
element type
E
>
void
assertAreAtMost(AssertionInfo
contains information about the assertion.
info
,
E[]
the given array.
actual
,
int
the number of times the condition should be at most verified.
n
,
Condition<? super E>
the given Condition.
condition
)

Assert that there are at most n array elements satisfying the given condition.

public <
element type
E
>
void
assertAreExactly(AssertionInfo
contains information about the assertion.
info
,
E[]
the given array.
actual
,
int
the exact number of times the condition should be verified.
n
,
Condition<? super E>
the given Condition.
condition
)

Verifies that there are exactly n array elements satisfying the given condition.

public <
element type
E
>
void
assertAreNot(AssertionInfo
contains information about the assertion.
info
,
E[]
the given array.
actual
,
Condition<? super E>
the given Condition.
condition
)

Assert that each element of given array not satisfies the given condition.

public void
assertContains(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
Object[]
the values that are expected to be in the given array.
values
)

Asserts that the given array contains the given values, in any order.

public void
assertContains(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
Object
the object to look for.
value
,
Index
the index where the object should be stored in the given array.
index
)

Verifies that the given array contains the given object at the given index.

public <
element type
E
>
void
assertContainsAll(AssertionInfo
contains information about the assertion.
info
,
E[]
the given array.
actual
,
Iterable<? extends E>
the other Iterable.
other
)

Asserts that the given array contains all the elements of the given Iterable, in any order.

public void
assertContainsAnyOf(AssertionInfo info, Object[] actual, Object[] values)

public void
public void
public void
assertContainsNull(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
)

Asserts that the given array contains at least a null element.

public void
assertContainsOnly(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
Object[]
the values that are expected to be in the given array.
values
)

Asserts that the given array contains only the given values and nothing else, in any order.

public void
assertContainsOnlyNulls(AssertionInfo
contains information about the assertion
info
,
Object[]
the given array
actual
)

Asserts that the given array contains only null elements.

public void
assertContainsOnlyOnce(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
Object[]
the values that are expected to be in the given array.
values
)

Asserts that the given array contains only once the given values.

public void
assertContainsSequence(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
Object[]
the sequence of objects to look for.
sequence
)

Verifies that the given array contains the given sequence of objects, without any other objects between them.

public void
assertContainsSubsequence(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
Object[]
the subsequence of objects to look for.
subsequence
)

Verifies that the given array contains the given subsequence of objects (possibly with other values between them).

public void
assertDoesNotContain(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
Object
the object to look for.
value
,
Index
the index where the object should be stored in the given array.
index
)

Verifies that the given array does not contain the given object at the given index.

public void
assertDoesNotContain(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
Object[]
the values that are expected not to be in the given array.
values
)

Asserts that the given array does not contain the given values.

public <T> void
assertDoesNotContainAnyElementsOf(AssertionInfo info, Object[] actual, Iterable<? extends T> iterable)

public void
assertDoesNotContainNull(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
)

Asserts that the given array does not contain null elements.

public void
assertDoesNotContainSequence(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
Object[]
the sequence of objects to look for.
sequence
)

Verifies that the given array does not contain the given sequence of objects in order.

public void
assertDoesNotContainSubsequence(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
Object[]
the subsequence of objects to look for.
subsequence
)

Verifies that the given array does not contain the given subsequence of objects (possibly with other values between them).

public <E> void
assertDoesNotHaveAnyElementsOfTypes(AssertionInfo info, E[] actual, Class<?>... unexpectedTypes)

public void
assertDoesNotHaveDuplicates(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
)

Asserts that the given array does not have duplicate values.

public <
element type
E
>
void
assertDoNotHave(AssertionInfo
contains information about the assertion.
info
,
E[]
the given array.
actual
,
Condition<? super E>
the given Condition.
condition
)

Assert that each element of given array not satisfies the given condition.

public void
assertEmpty(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
)

Asserts that the given array is empty.

public void
assertEndsWith(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
Object
the first element of the end sequence of objects to look for.
first
,
Object[]
the rest of the end sequence of objects to look for.
rest
)

Verifies that the given array ends with the given sequence of objects, without any other objects between them.

public void
assertEndsWith(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
Object[]
the sequence of objects to look for.
sequence
)

Verifies that the given array ends with the given sequence of objects, without any other objects between them.

public <E> void
public <E> void
assertHasExactlyElementsOfTypes(AssertionInfo info, E[] actual, Class<?>... expectedTypes)

public <E> void
assertHasOnlyElementsOfType(AssertionInfo info, E[] actual, Class<?> type)

public <E> void
assertHasOnlyElementsOfTypes(AssertionInfo info, E[] actual, Class<?>... types)

public void
assertHasSameSizeAs(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given iterable.
actual
,
Iterable<?>
the group to compare
other
)

Assert that the actual array has the same size as the other Iterable.

public void
assertHasSameSizeAs(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
Object
the group to compare
other
)

Assert that the actual array has the same size as the other array.

public void
assertHasSize(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
int
the expected size of actual.
expectedSize
)

Asserts that the number of elements in the given array is equal to the expected one.

public void
assertHasSizeBetween(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
int
the lower boundary compared to which actual size should be greater than or equal to.
lowerBoundary
,
int
the higher boundary compared to which actual size should be less than or equal to.
higherBoundary
)

Asserts that the number of elements in the given array is between the given lower and higher boundary (inclusive).

public void
assertHasSizeGreaterThan(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
int
the given value to compare the size of actual to.
boundary
)

Asserts that the number of elements in the given array is greater than the given boundary.

public void
assertHasSizeGreaterThanOrEqualTo(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
int
the given value to compare the size of actual to.
boundary
)

Asserts that the number of elements in the given array is greater than or equal to the given boundary.

public void
assertHasSizeLessThan(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
int
the given value to compare the size of actual to.
boundary
)

Asserts that the number of elements in the given array is less than the given boundary.

public void
assertHasSizeLessThanOrEqualTo(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
int
the given value to compare the size of actual to.
boundary
)

Asserts that the number of elements in the given array is less than or equal to the given boundary.

public <
element type
E
>
void
assertHave(AssertionInfo
contains information about the assertion.
info
,
E[]
the given array.
actual
,
Condition<? super E>
the given Condition.
condition
)

Assert that each element of given array satisfies the given condition.

public <
element type
E
>
void
assertHaveAtLeast(AssertionInfo
contains information about the assertion.
info
,
E[]
the given array.
actual
,
int
the minimum number of times the condition should be verified.
times
,
Condition<? super E>
the given Condition.
condition
)

An alias method of assertAreAtLeast(AssertionInfo, Object[], int, Condition) to provide a richer fluent api (same logic, only error message differs).

public <
element type
E
>
void
assertHaveAtMost(AssertionInfo
contains information about the assertion.
info
,
E[]
the given array.
actual
,
int
the number of times the condition should be at most verified.
times
,
Condition<? super E>
the given Condition.
condition
)

An alias method of assertAreAtMost(AssertionInfo, Object[], int, Condition) to provide a richer fluent api (same logic, only error message differs).

public <
element type
E
>
void
assertHaveExactly(AssertionInfo
contains information about the assertion.
info
,
E[]
the given array.
actual
,
int
the exact number of times the condition should be verified.
times
,
Condition<? super E>
the given Condition.
condition
)

An alias method of assertAreExactly(AssertionInfo, Object[], int, Condition) to provide a richer fluent api (same logic, only error message differs).

public void
assertIsSorted(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
)

Concrete implementation of ArraySortedAssert#isSorted().

public <
element type
E
>
void
assertIsSortedAccordingToComparator(AssertionInfo
contains information about the assertion.
info
,
E[]
the given array.
actual
,
Comparator<? super E>
the Comparator used to compare array elements
comparator
)

Concrete implementation of ArraySortedAssert#isSortedAccordingTo(Comparator).

public void
assertIsSubsetOf(AssertionInfo info, Object actual, Iterable<?> values)

public void
assertNotEmpty(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
)

Asserts that the given array is not empty.

public void
assertNullOrEmpty(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
)

Asserts that the given array is null or empty.

public void
assertStartsWith(AssertionInfo
contains information about the assertion.
info
,
Object[]
the given array.
actual
,
Object[]
the sequence of objects to look for.
sequence
)

Verifies that the given array starts with the given sequence of objects, without any other objects between them.

public Comparator<?>
public ComparisonStrategy
public static ObjectArrays

Returns:

the singleton instance of this class.
instance
()

Returns the singleton instance of this class.

pack-priv void
setArrays(Arrays arrays)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait