public abstract class AbstractBooleanArrayAssert<S extends AbstractBooleanArrayAssert<S>> extends AbstractAssert<S,boolean[]> implements EnumerableAssert<AbstractBooleanArrayAssert<S>,Boolean>, ArraySortedAssert<AbstractBooleanArrayAssert<S>,Boolean>
Modifier and Type | Field and Description |
---|---|
protected BooleanArrays |
arrays |
actual, info, myself
Constructor and Description |
---|
AbstractBooleanArrayAssert(boolean[] actual,
Class<?> selfType) |
Modifier and Type | Method and Description |
---|---|
S |
contains(boolean... values)
Verifies that the actual array contains the given values, in any order.
|
S |
contains(boolean value,
Index index)
Verifies that the actual array contains the given value at the given index.
|
S |
containsExactly(boolean... values)
Verifies that the actual group contains only the given values and nothing else, in order.
|
S |
containsOnly(boolean... values)
Verifies that the actual array contains only the given values and nothing else, in any order.
|
S |
containsOnlyOnce(boolean... values)
Verifies that the actual array contains the given values only once.
|
S |
containsSequence(boolean... sequence)
Verifies that the actual array contains the given sequence, without any other values between them.
|
S |
doesNotContain(boolean... values)
Verifies that the actual array does not contain the given values.
|
S |
doesNotContain(boolean value,
Index index)
Verifies that the actual array does not contain the given value at the given index.
|
S |
doesNotHaveDuplicates()
Verifies that the actual array does not contain duplicates.
|
S |
endsWith(boolean... sequence)
Verifies that the actual array ends with the given sequence of values, without any other values between them.
|
S |
hasSameSizeAs(Iterable<?> other)
Verifies that the actual group has the same size as given
Iterable . |
S |
hasSameSizeAs(Object[] other)
Verifies that the actual group has the same size as given array.
|
S |
hasSize(int expected)
Verifies that the number of values in the actual group is equal to the given one.
|
void |
isEmpty()
Verifies that the actual group of values is empty.
|
S |
isNotEmpty()
Verifies that the actual group of values is not empty.
|
void |
isNullOrEmpty()
Verifies that the actual group of values is
null or empty. |
S |
isSorted()
Verifies that the actual array is sorted into ascending order according to the natural ordering of its elements.
|
S |
isSortedAccordingTo(Comparator<? super Boolean> comparator)
Verifies that the actual array is sorted according to the given comparator. Empty arrays are considered sorted whatever
the comparator is. One element arrays are considered sorted if element is compatible with comparator, otherwise an
AssertionError is thrown.
|
S |
startsWith(boolean... sequence)
Verifies that the actual array starts with the given sequence of values, without any other values between them.
|
S |
usingDefaultElementComparator()
Deprecated.
Custom element Comparator is not supported for Boolean array comparison.
|
S |
usingElementComparator(Comparator<? super Boolean> customComparator)
Deprecated.
Custom element Comparator is not supported for Boolean array comparison.
|
as, as, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, overridingErrorMessage, usingComparator, usingDefaultComparator
protected BooleanArrays arrays
public AbstractBooleanArrayAssert(boolean[] actual, Class<?> selfType)
public void isNullOrEmpty()
null
or empty.isNullOrEmpty
in interface EnumerableAssert<AbstractBooleanArrayAssert<S extends AbstractBooleanArrayAssert<S>>,Boolean>
public void isEmpty()
isEmpty
in interface EnumerableAssert<AbstractBooleanArrayAssert<S extends AbstractBooleanArrayAssert<S>>,Boolean>
public S isNotEmpty()
isNotEmpty
in interface EnumerableAssert<AbstractBooleanArrayAssert<S extends AbstractBooleanArrayAssert<S>>,Boolean>
this
assertion object.public S hasSize(int expected)
hasSize
in interface EnumerableAssert<AbstractBooleanArrayAssert<S extends AbstractBooleanArrayAssert<S>>,Boolean>
expected
- the expected number of values in the actual group.this
assertion object.public S hasSameSizeAs(Object[] other)
hasSameSizeAs
in interface EnumerableAssert<AbstractBooleanArrayAssert<S extends AbstractBooleanArrayAssert<S>>,Boolean>
other
- the array to compare size with actual group.this
assertion object.public S hasSameSizeAs(Iterable<?> other)
Iterable
.hasSameSizeAs
in interface EnumerableAssert<AbstractBooleanArrayAssert<S extends AbstractBooleanArrayAssert<S>>,Boolean>
other
- the Iterable
to compare size with actual group.this
assertion object.public S contains(boolean... values)
values
- the given values.this
assertion object.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual array is null
.AssertionError
- if the actual array does not contain the given values.public S containsOnly(boolean... values)
values
- the given values.this
assertion object.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual array is null
.AssertionError
- if the actual array does not contain the given values, i.e. the actual array contains some
or none of the given values, or the actual array contains more values than the given ones.public S containsOnlyOnce(boolean... values)
Examples :
// assertion will pass assertThat(new boolean[] { true, false }).containsOnlyOnce(true, false); // assertions will fail assertThat(new boolean[] { true, false, true }).containsOnlyOnce(true); assertThat(new boolean[] { true }).containsOnlyOnce(false); assertThat(new boolean[] { true }).containsOnlyOnce(true, false);
values
- the given values.this
assertion object.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual array is null
.AssertionError
- if the actual group does not contain the given values, i.e. the actual group contains some
or none of the given values, or the actual group contains more than once these values.public S containsSequence(boolean... sequence)
sequence
- the sequence of values to look for.AssertionError
- if the actual array is null
.AssertionError
- if the given array is null
.AssertionError
- if the actual array does not contain the given sequence.public S contains(boolean value, Index index)
value
- the value to look for.index
- the index where the value should be stored in the actual array.AssertionError
- if the actual 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 actual array.AssertionError
- if the actual array does not contain the given value at the given index.public S doesNotContain(boolean... values)
values
- the given values.this
assertion object.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual array is null
.AssertionError
- if the actual array contains any of the given values.public S doesNotContain(boolean value, Index index)
value
- the value to look for.index
- the index where the value should be stored in the actual array.AssertionError
- if the actual array is null
.NullPointerException
- if the given Index
is null
.AssertionError
- if the actual array contains the given value at the given index.public S doesNotHaveDuplicates()
this
assertion object.AssertionError
- if the actual array is null
.AssertionError
- if the actual array contains duplicates.public S startsWith(boolean... sequence)
containsSequence(boolean...)
, but it also verifies that the first element in the
sequence is also first element of the actual array.sequence
- the sequence of values to look for.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual array is null
.AssertionError
- if the actual array does not start with the given sequence.public S endsWith(boolean... sequence)
containsSequence(boolean...)
, but it also verifies that the last element in the
sequence is also last element of the actual array.sequence
- the sequence of values to look for.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual array is null
.AssertionError
- if the actual array does not end with the given sequence.public S isSorted()
All array elements must be primitive or implement the Comparable
interface and must be mutually comparable (that is,
e1.compareTo(e2) must not throw a ClassCastException for any elements e1 and e2 in the array), examples :
isSorted
in interface ArraySortedAssert<AbstractBooleanArrayAssert<S extends AbstractBooleanArrayAssert<S>>,Boolean>
this
assertion object.public S isSortedAccordingTo(Comparator<? super Boolean> comparator)
isSortedAccordingTo
in interface ArraySortedAssert<AbstractBooleanArrayAssert<S extends AbstractBooleanArrayAssert<S>>,Boolean>
comparator
- the Comparator
used to compare array elementsthis
assertion object.@Deprecated public final S usingElementComparator(Comparator<? super Boolean> customComparator)
usingElementComparator
in interface EnumerableAssert<AbstractBooleanArrayAssert<S extends AbstractBooleanArrayAssert<S>>,Boolean>
customComparator
- the comparator to use for incoming assertion checks.this
assertion object.UnsupportedOperationException
- if this method is called.@Deprecated public final S usingDefaultElementComparator()
usingDefaultElementComparator
in interface EnumerableAssert<AbstractBooleanArrayAssert<S extends AbstractBooleanArrayAssert<S>>,Boolean>
this
assertion object.UnsupportedOperationException
- if this method is called.public S containsExactly(boolean... values)
Example :
boolean[] booleans = { true, false, true }; // assertion will pass assertThat(booleans).containsExactly(true, false, true); // assertion will fail as actual and expected orders differ. assertThat(booleans).containsExactly(false, true, true);
values
- the given values.this
assertion object.NullPointerException
- if the given argument is null
.AssertionError
- if the actual group is null
.AssertionError
- if the actual group does not contain the given values with same order, i.e. the actual group
contains some or none of the given values, or the actual group contains more values than the given ones
or values are the same but the order is not.Copyright © 2013 AssertJ. All Rights Reserved.