Interface ArrayComponent<S,T,E>
- Type Parameters:
S
- the type this validatorT
- the type of the arrayE
- the type of elements in the array
- All Known Subinterfaces:
ByteArrayValidator
,ObjectArrayValidator<T,
,E> PrimitiveBooleanArrayValidator
,PrimitiveByteArrayValidator
,PrimitiveCharacterArrayValidator
,PrimitiveDoubleArrayValidator
,PrimitiveFloatArrayValidator
,PrimitiveIntegerArrayValidator
,PrimitiveLongArrayValidator
,PrimitiveShortArrayValidator
public interface ArrayComponent<S,T,E>
Methods that all array validators must contain.
-
Method Summary
Modifier and TypeMethodDescriptionEnsures that the array contains an element.Ensures that the array contains an element.<C extends Collection<E>>
ScontainsAll
(C expected) Ensures that the array contains all the elements inexpected
.<C extends Collection<E>>
ScontainsAll
(C expected, String name) Ensures that the array contains all the elements inexpected
.containsAll
(T expected) Ensures that the array contains all the elements inexpected
.containsAll
(T expected, String name) Ensures that the array contains all the elements inexpected
.<C extends Collection<E>>
ScontainsAny
(C expected) Ensures that the array contains any elements inexpected
.<C extends Collection<E>>
ScontainsAny
(C expected, String name) Ensures that the array contains at least one element inexpected
.containsAny
(T expected) Ensures that the array contains any elements inexpected
.containsAny
(T expected, String name) Ensures that the array contains at least one element inexpected
.<C extends Collection<E>>
ScontainsExactly
(C expected) Ensures that the array consists of the same elements asexpected
, irrespective of their order.<C extends Collection<E>>
ScontainsExactly
(C expected, String name) Ensures that the array consists of the same elements asexpected
, irrespective of their order.containsExactly
(T expected) Ensures that the array consists of the same elements asexpected
, irrespective of their order.containsExactly
(T expected, String name) Ensures that the array consists of the same elements asexpected
, irrespective of their order.doesNotContain
(E unwanted) Ensures that the array does not containunwanted
.doesNotContain
(E unwanted, String name) Ensures that the array does not containunwanted
.<C extends Collection<E>>
SdoesNotContainAll
(C unwanted) Allows the array to contain some, but not all, elements from a collection.<C extends Collection<E>>
SdoesNotContainAll
(C unwanted, String name) Allows the array to contain some, but not all, elements from a collection.doesNotContainAll
(T unwanted) Allows the array to contain some, but not all, elements from a collection.doesNotContainAll
(T unwanted, String name) Allows the array to contain some, but not all, elements from a collection.<C extends Collection<E>>
SdoesNotContainAny
(C unwanted) Ensures that the array does not contain any of the elements inunwanted
.<C extends Collection<E>>
SdoesNotContainAny
(C unwanted, String name) Ensures that the array does not contain any of the elements inunwanted
.doesNotContainAny
(T unwanted) Ensures that the array does not contain any of the elements inunwanted
.doesNotContainAny
(T unwanted, String name) Ensures that the array does not contain any of the elements inunwanted
.Ensures that the array does not contain any duplicate elements.<C extends Collection<E>>
SdoesNotContainExactly
(C unwanted) Ensures that the array andunwanted
consist of different elements, irrespective of their order.<C extends Collection<E>>
SdoesNotContainExactly
(C unwanted, String name) Ensures that the array andunwanted
consist of different elements, irrespective of their order.doesNotContainExactly
(T unwanted) Ensures that the array andunwanted
consist of different elements, irrespective of their order.doesNotContainExactly
(T unwanted, String name) Ensures that the array andunwanted
consist of different elements, irrespective of their order.isEmpty()
Ensures that the array is empty.Ensures that the array is not empty.isSorted
(Comparator<E> comparator) Ensures that the array is sorted.length()
Returns a validator for the array's length.
-
Method Details
-
isEmpty
S isEmpty()Ensures that the array is empty.- Returns:
- this
- Throws:
NullPointerException
- if the value isnull
IllegalArgumentException
- if the array is not empty
-
isNotEmpty
S isNotEmpty()Ensures that the array is not empty.- Returns:
- this
- Throws:
NullPointerException
- if the value isnull
IllegalArgumentException
- if the array is empty
-
contains
Ensures that the array contains an element.- Parameters:
expected
- the element- Returns:
- this
- Throws:
NullPointerException
- if the value orexpected
are nullIllegalArgumentException
- if the array does not containexpected
-
contains
Ensures that the array contains an element.- Parameters:
expected
- the elementname
- the name of the element- Returns:
- this
- Throws:
NullPointerException
- if the value or any of the arguments are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the array does not contain
expected
-
doesNotContain
Ensures that the array does not containunwanted
.- Parameters:
unwanted
- the unwanted element- Returns:
- this
- Throws:
NullPointerException
- if the value or any of the arguments are nullIllegalArgumentException
- if the array containsunwanted
-
doesNotContain
Ensures that the array does not containunwanted
.- Parameters:
unwanted
- the unwanted elementname
- the name of the element- Returns:
- this
- Throws:
NullPointerException
- if the value or any of the arguments are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the array contains
unwanted
-
containsExactly
Ensures that the array consists of the same elements asexpected
, irrespective of their order.In contrast,
isEqualTo()
requires the same element ordering.- Parameters:
expected
- the desired elements- Returns:
- this
- Throws:
NullPointerException
- if the value orexpected
are nullIllegalArgumentException
- if:- the array is missing any element in
expected
- the array contains any element that is not in
expected
- the array is missing any element in
-
containsExactly
Ensures that the array consists of the same elements asexpected
, irrespective of their order.In contrast,
isEqualTo()
requires the same element ordering.- Type Parameters:
C
- the type of collection to compare against- Parameters:
expected
- the desired elements- Returns:
- this
- Throws:
NullPointerException
- if the value orexpected
are nullIllegalArgumentException
- if:- the array is missing any element in
expected
- the array contains any element that is not in
expected
- the array is missing any element in
-
containsExactly
Ensures that the array consists of the same elements asexpected
, irrespective of their order.In contrast,
isEqualTo()
requires the same element ordering.- Parameters:
expected
- the desired elementsname
- the name of the expected collection- Returns:
- this
- Throws:
NullPointerException
- if the value or any of the arguments are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the array and
expected
contain different elements, irrespective of their order
-
containsExactly
Ensures that the array consists of the same elements asexpected
, irrespective of their order.In contrast,
isEqualTo()
requires the same element ordering.- Type Parameters:
C
- the type of collection to compare against- Parameters:
expected
- the desired elementsname
- the name of the expected collection- Returns:
- this
- Throws:
NullPointerException
- if the value or any of the arguments are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the array and
expected
contain different elements, irrespective of their order
-
doesNotContainExactly
Ensures that the array andunwanted
consist of different elements, irrespective of their order.- Parameters:
unwanted
- the unwanted elements- Returns:
- this
- Throws:
NullPointerException
- if the value orunwanted
are nullIllegalArgumentException
- if the array consists of the same elements asunwanted
, irrespective of their order
-
doesNotContainExactly
Ensures that the array andunwanted
consist of different elements, irrespective of their order.- Type Parameters:
C
- the type of collection to compare against- Parameters:
unwanted
- the unwanted elements- Returns:
- this
- Throws:
NullPointerException
- if the value orunwanted
are nullIllegalArgumentException
- if the array consists of the same elements asunwanted
, irrespective of their order
-
doesNotContainExactly
Ensures that the array andunwanted
consist of different elements, irrespective of their order.- Parameters:
unwanted
- the unwanted elementsname
- the name of the unwanted collection- Returns:
- this
- Throws:
NullPointerException
- if the value or any of the arguments are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the array consists of the same elements as
unwanted
, irrespective of their order
-
doesNotContainExactly
Ensures that the array andunwanted
consist of different elements, irrespective of their order.- Type Parameters:
C
- the type of collection to compare against- Parameters:
unwanted
- the unwanted elementsname
- the name of the unwanted collection- Returns:
- this
- Throws:
NullPointerException
- if the value or any of the arguments are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the array consists of the same elements as
unwanted
, irrespective of their order
-
containsAny
Ensures that the array contains any elements inexpected
.- Parameters:
expected
- the desired elements- Returns:
- this
- Throws:
NullPointerException
- if the value orexpected
are nullIllegalArgumentException
- if the array does not contain any element inexpected
-
containsAny
Ensures that the array contains any elements inexpected
.- Type Parameters:
C
- the type of collection to compare against- Parameters:
expected
- the desired elements- Returns:
- this
- Throws:
NullPointerException
- if the value orexpected
are nullIllegalArgumentException
- if the array does not contain any element inexpected
-
containsAny
Ensures that the array contains at least one element inexpected
.- Parameters:
expected
- the desired elementsname
- the name of the expected collection- Returns:
- this
- Throws:
NullPointerException
- if the value or any of the arguments are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the array does not contain any element in
expected
-
containsAny
Ensures that the array contains at least one element inexpected
.- Type Parameters:
C
- the type of collection to compare against- Parameters:
expected
- the desired elementsname
- the name of the expected collection- Returns:
- this
- Throws:
NullPointerException
- if the value or any of the arguments are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the array does not contain any element in
expected
/li>
-
doesNotContainAny
Ensures that the array does not contain any of the elements inunwanted
.- Parameters:
unwanted
- the unwanted elements- Returns:
- this
- Throws:
NullPointerException
- if the value orunwanted
are nullIllegalArgumentException
- if the array contains any of the elements inunwanted
-
doesNotContainAny
Ensures that the array does not contain any of the elements inunwanted
.- Type Parameters:
C
- the type of collection to compare against- Parameters:
unwanted
- the unwanted elements- Returns:
- this
- Throws:
NullPointerException
- if the value orunwanted
are nullIllegalArgumentException
- if the array contains any of the elements inunwanted
-
doesNotContainAny
Ensures that the array does not contain any of the elements inunwanted
.- Parameters:
unwanted
- the unwanted elementsname
- the name of the unwanted collection- Returns:
- this
- Throws:
NullPointerException
- if the value or any of the arguments are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the array contains any of the elements in
unwanted
-
doesNotContainAny
Ensures that the array does not contain any of the elements inunwanted
.- Type Parameters:
C
- the type of collection to compare against- Parameters:
unwanted
- the unwanted elementsname
- the name of the unwanted collection- Returns:
- this
- Throws:
NullPointerException
- if the value or any of the arguments are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the array contains any of the elements in
unwanted
-
containsAll
Ensures that the array contains all the elements inexpected
.- Parameters:
expected
- the desired elements- Returns:
- this
- Throws:
NullPointerException
- if the value orexpected
are nullIllegalArgumentException
- if the array does not contain all the elements inexpected
-
containsAll
Ensures that the array contains all the elements inexpected
.- Type Parameters:
C
- the type of collection to compare against- Parameters:
expected
- the desired elements- Returns:
- this
- Throws:
NullPointerException
- if the value orexpected
are nullIllegalArgumentException
- if the array does not contain all the elements inexpected
-
containsAll
Ensures that the array contains all the elements inexpected
.- Parameters:
expected
- the desired elementsname
- the name of the expected collection- Returns:
- this
- Throws:
NullPointerException
- if the value or any of the arguments are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the array does not contain all the elements in
expected
/li>
-
containsAll
Ensures that the array contains all the elements inexpected
.- Type Parameters:
C
- the type of collection to compare against- Parameters:
expected
- the desired elementsname
- the name of the expected collection- Returns:
- this
- Throws:
NullPointerException
- if the value or any of the arguments are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the array does not contain all elements in
expected
-
doesNotContainAll
Allows the array to contain some, but not all, elements from a collection.- Parameters:
unwanted
- the unwanted elements- Returns:
- this
- Throws:
NullPointerException
- if the value orunwanted
are nullIllegalArgumentException
- if the array contains all the elements ofunwanted
-
doesNotContainAll
Allows the array to contain some, but not all, elements from a collection.- Type Parameters:
C
- the type of collection to compare against- Parameters:
unwanted
- the unwanted elements- Returns:
- this
- Throws:
NullPointerException
- if the value orunwanted
are nullIllegalArgumentException
- if the array contains all the elements ofunwanted
-
doesNotContainAll
Allows the array to contain some, but not all, elements from a collection.- Parameters:
unwanted
- the unwanted elementsname
- the name of the unwanted collection- Returns:
- this
- Throws:
NullPointerException
- if the value or any of the arguments are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the array contains all the elements in
unwanted
-
doesNotContainAll
Allows the array to contain some, but not all, elements from a collection.- Type Parameters:
C
- the type of collection to compare against- Parameters:
unwanted
- the unwanted elementsname
- the name of the unwanted collection- Returns:
- this
- Throws:
NullPointerException
- if the value or any of the arguments are nullIllegalArgumentException
- if:name
is emptyname
contains whitespacename
is already in use by the value being validated or the validator context- the array contains all the elements in
unwanted
-
isSorted
Ensures that the array is sorted.- Parameters:
comparator
- the comparator that defines the expected order of the elements- Returns:
- this
- Throws:
NullPointerException
- if the value orcomparator
are nullIllegalArgumentException
- if the array is not sorted- See Also:
-
doesNotContainDuplicates
S doesNotContainDuplicates()Ensures that the array does not contain any duplicate elements.- Returns:
- this
- Throws:
NullPointerException
- if the value isnull
IllegalArgumentException
- if the array contains any duplicate elements
-
length
PrimitiveUnsignedIntegerValidator length()Returns a validator for the array's length.- Returns:
- a validator for the array's length
- Throws:
NullPointerException
- if the value isnull
-