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

public Class BooleanArrays

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 booleans.
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 BooleanArrays

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
assertContains(AssertionInfo
contains information about the assertion.
info
,
boolean[]
the given array.
actual
,
boolean[]
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
,
boolean[]
the given array.
actual
,
boolean
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, boolean[] actual, boolean[] values)

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

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

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

Asserts that the given array does not have duplicate values.

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

Asserts that the given array is empty.

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

Concrete implementation of ArraySortedAssert#isSorted().

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

Concrete implementation of ArraySortedAssert#isSortedAccordingTo(Comparator).

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

Asserts that the given array is not empty.

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

Asserts that the given array is null or empty.

public void
assertStartsWith(AssertionInfo
contains information about the assertion.
info
,
boolean[]
the given array.
actual
,
boolean[]
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 static BooleanArrays

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 BooleanArrays INSTANCE

Constructor Detail

BooleanArraysback to summary
pack-priv BooleanArrays()
Annotations
@VisibleForTesting

Method Detail

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

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:boolean[]

the given array.

values:boolean[]

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, boolean[] actual, boolean 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:boolean[]

the given array.

value:boolean

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, boolean[] actual, boolean[] values)
assertContainsExactlyback to summary
public void assertContainsExactly(AssertionInfo info, boolean[] actual, boolean[] values)
assertContainsExactlyInAnyOrderback to summary
public void assertContainsExactlyInAnyOrder(AssertionInfo info, boolean[] actual, boolean[] values)
assertContainsOnlyback to summary
public void assertContainsOnly(AssertionInfo info, boolean[] actual, boolean[] 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:boolean[]

the given array.

values:boolean[]

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, boolean[] actual, boolean[] values)

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:boolean[]

the given array.

values:boolean[]

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, boolean[] actual, boolean[] 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:boolean[]

the given array.

sequence:boolean[]

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, boolean[] actual, boolean[] 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:boolean[]

the given array.

subsequence:boolean[]

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, boolean[] actual, boolean 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:boolean[]

the given array.

value:boolean

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, boolean[] actual, boolean[] values)

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

Parameters
info:AssertionInfo

contains information about the assertion.

actual:boolean[]

the given array.

values:boolean[]

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, boolean[] actual)

Asserts that the given array does not have duplicate values.

Parameters
info:AssertionInfo

contains information about the assertion.

actual:boolean[]

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, boolean[] actual)

Asserts that the given array is empty.

Parameters
info:AssertionInfo

contains information about the assertion.

actual:boolean[]

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, boolean[] actual, boolean[] sequence)

Verifies that the given array ends with the given sequence of values, without any other values between them. Similar to assertContainsSequence(AssertionInfo, boolean[], boolean[]), 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:boolean[]

the given array.

sequence:boolean[]

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, boolean[] 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:boolean[]

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, boolean[] 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:boolean[]

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, boolean[] 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:boolean[]

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, boolean[] 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:boolean[]

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, boolean[] 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:boolean[]

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, boolean[] 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:boolean[]

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, boolean[] 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:boolean[]

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, boolean[] 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:boolean[]

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, boolean[] actual)

Concrete implementation of ArraySortedAssert#isSorted().

Parameters
info:AssertionInfo

contains information about the assertion.

actual:boolean[]

the given array.

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

Concrete implementation of ArraySortedAssert#isSortedAccordingTo(Comparator).

Parameters
info:AssertionInfo

contains information about the assertion.

actual:boolean[]

the given array.

comparator:Comparator<? super Boolean>

the Comparator used to compare array elements

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

Asserts that the given array is not empty.

Parameters
info:AssertionInfo

contains information about the assertion.

actual:boolean[]

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, boolean[] actual)

Asserts that the given array is null or empty.

Parameters
info:AssertionInfo

contains information about the assertion.

actual:boolean[]

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, boolean[] actual, boolean[] sequence)

Verifies that the given array starts with the given sequence of values, without any other values between them. Similar to assertContainsSequence(AssertionInfo, boolean[], boolean[]), 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:boolean[]

the given array.

sequence:boolean[]

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.
instanceback to summary
public static BooleanArrays instance()

Returns the singleton instance of this class.

Returns:BooleanArrays

the singleton instance of this class.

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