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

public Class LongArrays

extends Object
Class Inheritance
Imports
java.util.Comparator, org.assertj.core.api.ArraySortedAssert, .AssertionInfo, org.assertj.core.data.Index, org.assertj.core.util.VisibleForTesting

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

Field Summary

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

Constructor Summary

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

Method Summary

Modifier and TypeMethod and Description
public void
assertContains(AssertionInfo
contains information about the assertion.
info
,
long[]
the given array.
actual
,
long[]
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
,
long[]
the given array.
actual
,
long
the value to look for.
value
,
Index
the index where the value should be stored in the given array.
index
)

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

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

public void
assertContainsExactly(AssertionInfo info, long[] actual, long[] values)

public void
assertContainsExactlyInAnyOrder(AssertionInfo info, long[] actual, long[] values)

public void
assertContainsOnly(AssertionInfo
contains information about the assertion.
info
,
long[]
the given array.
actual
,
long[]
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
assertContainsOnlyOnce(AssertionInfo
contains information about the assertion.
info
,
long[]
the given array.
actual
,
long[]
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
,
long[]
the given array.
actual
,
long[]
the sequence of values to look for.
sequence
)

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

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

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

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

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

public void
assertDoesNotContain(AssertionInfo
contains information about the assertion.
info
,
long[]
the given array.
actual
,
long[]
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 void
assertDoesNotHaveDuplicates(AssertionInfo
contains information about the assertion.
info
,
long[]
the given array.
actual
)

Asserts that the given array does not have duplicate values.

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

Asserts that the given array is empty.

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

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

public void
assertHasSameSizeAs(AssertionInfo
contains information about the assertion.
info
,
long[]
the given array.
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
,
long[]
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
,
long[]
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
,
long[]
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
,
long[]
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
,
long[]
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
,
long[]
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
,
long[]
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 void
assertIsSorted(AssertionInfo
contains information about the assertion.
info
,
long[]
the given array.
actual
)

Concrete implementation of ArraySortedAssert#isSorted().

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

Concrete implementation of ArraySortedAssert#isSortedAccordingTo(Comparator).

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

Asserts that the given array is not empty.

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

Asserts that the given array is null or empty.

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

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

public Comparator<?>
public static LongArrays

Returns:

the singleton instance of this class.
instance
()

Returns the singleton instance of this class.

public void
setArrays(Arrays arrays)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

arraysback to summary
private Arrays arrays
failuresback to summary
pack-priv Failures failures
Annotations
@VisibleForTesting
INSTANCEback to summary
private static final LongArrays INSTANCE

Constructor Detail

LongArraysback to summary
pack-priv LongArrays()
Annotations
@VisibleForTesting
LongArraysback to summary
public LongArrays(ComparisonStrategy comparisonStrategy)

Method Detail

assertContainsback to summary
public void assertContains(AssertionInfo info, long[] actual, long[] values)

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

values:long[]

the values that are expected to be in the given array.

Exceptions
NullPointerException:
if the array of values is null.
IllegalArgumentException:
if the array of values is empty.
AssertionError:
  • if the given array is null.
  • if the given array does not contain the given values.
assertContainsback to summary
public void assertContains(AssertionInfo info, long[] actual, long value, Index index)

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

value:long

the value to look for.

index:Index

the index where the value should be stored in the given array.

Exceptions
AssertionError:
  • if the given array is null or empty.
  • if the given array does not contain the given value at the given index.
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.
assertContainsAnyOfback to summary
public void assertContainsAnyOf(AssertionInfo info, long[] actual, long[] values)
assertContainsExactlyback to summary
public void assertContainsExactly(AssertionInfo info, long[] actual, long[] values)
assertContainsExactlyInAnyOrderback to summary
public void assertContainsExactlyInAnyOrder(AssertionInfo info, long[] actual, long[] values)
assertContainsOnlyback to summary
public void assertContainsOnly(AssertionInfo info, long[] actual, long[] values)

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

values:long[]

the values that are expected to be in the given array.

Exceptions
NullPointerException:
if the array of values is null.
IllegalArgumentException:
if the array of values is empty.
AssertionError:
  • if the given array is null.
  • if the given array does not contain the given values or if the given array contains values that are not in the given array.
assertContainsOnlyOnceback to summary
public void assertContainsOnlyOnce(AssertionInfo info, long[] actual, long[] values)

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

values:long[]

the values that are expected to be in the given array.

Exceptions
NullPointerException:
if the array of values is null.
IllegalArgumentException:
if the array of values is empty.
AssertionError:
  • if the given array is null.
  • if the given array does not contain the given values or if the given array contains more than once values.
assertContainsSequenceback to summary
public void assertContainsSequence(AssertionInfo info, long[] actual, long[] sequence)

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

sequence:long[]

the sequence of values to look for.

Exceptions
AssertionError:
  • if the given array is null.
  • if the given array does not contain the given sequence of values.
NullPointerException:
if the given sequence is null.
IllegalArgumentException:
if the given sequence is empty.
assertContainsSubsequenceback to summary
public void assertContainsSubsequence(AssertionInfo info, long[] actual, long[] subsequence)

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

subsequence:long[]

the subsequence of values to look for.

Exceptions
AssertionError:
  • if the given array is null.
  • if the given array does not contain the given subsequence of values.
NullPointerException:
if the given subsequence is null.
IllegalArgumentException:
if the given subsequence is empty.
assertDoesNotContainback to summary
public void assertDoesNotContain(AssertionInfo info, long[] actual, long value, Index index)

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

value:long

the value to look for.

index:Index

the index where the value should be stored in the given array.

Exceptions
AssertionError:
  • if the given array is null.
  • if the given array contains the given value at the given index.
NullPointerException:
if the given Index is null.
assertDoesNotContainback to summary
public void assertDoesNotContain(AssertionInfo info, long[] actual, long[] values)

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

values:long[]

the values that are expected not to be in the given array.

Exceptions
NullPointerException:
if the array of values is null.
IllegalArgumentException:
if the array of values is empty.
AssertionError:
  • if the given array is null.
  • if the given array contains any of given values.
assertDoesNotHaveDuplicatesback to summary
public void assertDoesNotHaveDuplicates(AssertionInfo info, long[] actual)

Asserts that the given array does not have duplicate values.

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

Exceptions
NullPointerException:
if the array of values is null.
IllegalArgumentException:
if the array of values is empty.
AssertionError:
  • if the given array is null.
  • if the given array contains duplicate values.
assertEmptyback to summary
public void assertEmpty(AssertionInfo info, long[] actual)

Asserts that the given array is empty.

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

Exceptions
AssertionError:
  • if the given array is null.
  • if the given array is not empty.
assertEndsWithback to summary
public void assertEndsWith(AssertionInfo info, long[] actual, long[] sequence)

Verifies that the given array ends with the given sequence of values, without any other values between them. Similar to assertContainsSequence(AssertionInfo, long[], long[]), but it also verifies that the last element in the sequence is also the last element of the given array.

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

sequence:long[]

the sequence of values to look for.

Exceptions
NullPointerException:
if the given argument is null.
IllegalArgumentException:
if the given argument is an empty array.
AssertionError:
  • if the given array is null.
  • if the given array does not end with the given sequence of values.
assertHasSameSizeAsback to summary
public void assertHasSameSizeAs(AssertionInfo info, long[] actual, Iterable<?> other)

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

other:Iterable<?>

the group to compare

Exceptions
AssertionError:
  • if the actual group is null.
  • if the other group is null.
  • if the actual group does not have the same size.
assertHasSameSizeAsback to summary
public void assertHasSameSizeAs(AssertionInfo info, long[] actual, Object[] other)

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

other:Object[]

the group to compare

Exceptions
AssertionError:
  • if the actual group is null.
  • if the other group is null.
  • if the actual group does not have the same size.
assertHasSizeback to summary
public void assertHasSize(AssertionInfo info, long[] actual, int expectedSize)

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

expectedSize:int

the expected size of actual.

Exceptions
AssertionError:
  • if the given array is null.
  • if the number of elements in the given array is different than the expected one.
assertHasSizeBetweenback to summary
public void assertHasSizeBetween(AssertionInfo info, long[] actual, int lowerBoundary, int higherBoundary)

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

lowerBoundary:int

the lower boundary compared to which actual size should be greater than or equal to.

higherBoundary:int

the higher boundary compared to which actual size should be less than or equal to.

Exceptions
AssertionError:
  • if the given array is null.
  • if the number of elements in the given array is not between the boundaries.
assertHasSizeGreaterThanback to summary
public void assertHasSizeGreaterThan(AssertionInfo info, long[] actual, int boundary)

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

boundary:int

the given value to compare the size of actual to.

Exceptions
AssertionError:
  • if the given array is null.
  • if the number of elements in the given array is not greater than the boundary.
assertHasSizeGreaterThanOrEqualToback to summary
public void assertHasSizeGreaterThanOrEqualTo(AssertionInfo info, long[] actual, int boundary)

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

boundary:int

the given value to compare the size of actual to.

Exceptions
AssertionError:
  • if the given array is null.
  • if the number of elements in the given array is not greater than or equal to the boundary.
assertHasSizeLessThanback to summary
public void assertHasSizeLessThan(AssertionInfo info, long[] actual, int boundary)

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

boundary:int

the given value to compare the size of actual to.

Exceptions
AssertionError:
  • if the given array is null.
  • if the number of elements in the given array is not less than the boundary.
assertHasSizeLessThanOrEqualToback to summary
public void assertHasSizeLessThanOrEqualTo(AssertionInfo info, long[] actual, int boundary)

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

boundary:int

the given value to compare the size of actual to.

Exceptions
AssertionError:
  • if the given array is null.
  • if the number of elements in the given array is not less than or equal to the boundary.
assertIsSortedback to summary
public void assertIsSorted(AssertionInfo info, long[] actual)

Concrete implementation of ArraySortedAssert#isSorted().

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

assertIsSortedAccordingToComparatorback to summary
public void assertIsSortedAccordingToComparator(AssertionInfo info, long[] actual, Comparator<? super Long> comparator)

Concrete implementation of ArraySortedAssert#isSortedAccordingTo(Comparator).

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

comparator:Comparator<? super Long>

the Comparator used to compare array elements

assertNotEmptyback to summary
public void assertNotEmpty(AssertionInfo info, long[] actual)

Asserts that the given array is not empty.

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

Exceptions
AssertionError:
  • if the given array is null.
  • if the given array is empty.
assertNullOrEmptyback to summary
public void assertNullOrEmpty(AssertionInfo info, long[] actual)

Asserts that the given array is null or empty.

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

Exceptions
AssertionError:
if the given array is not null *and* contains one or more elements.
assertStartsWithback to summary
public void assertStartsWith(AssertionInfo info, long[] actual, long[] sequence)

Verifies that the given array starts with the given sequence of values, without any other values between them. Similar to assertContainsSequence(AssertionInfo, long[], long[]), but it also verifies that the first element in the sequence is also the first element of the given array.

Parameters
info:AssertionInfo

contains information about the assertion.

actual:long[]

the given array.

sequence:long[]

the sequence of values to look for.

Exceptions
NullPointerException:
if the given argument is null.
IllegalArgumentException:
if the given argument is an empty array.
AssertionError:
  • if the given array is null.
  • if the given array does not start with the given sequence of values.
getComparatorback to summary
public Comparator<?> getComparator()
Annotations
@VisibleForTesting
instanceback to summary
public static LongArrays instance()

Returns the singleton instance of this class.

Returns:LongArrays

the singleton instance of this class.

setArraysback to summary
public void setArrays(Arrays arrays)
Annotations
@VisibleForTesting