public class ListSizeConstraint extends Object implements ParameterConstraint<List<?>>
ListParameter
) to be tested has to be equal to the specified list
size constraint.Modifier and Type | Field and Description |
---|---|
private int |
sizeConstraint
The list size constraint.
|
Constructor and Description |
---|
ListSizeConstraint(int size)
Constructs a list size constraint with the given constraint size.
|
Modifier and Type | Method and Description |
---|---|
String |
getDescription(String parameterName)
Returns a description of this constraint.
|
void |
test(List<?> t)
Checks if the list parameter fulfills the size constraint.
|
public ListSizeConstraint(int size)
size
- the size constraint for the list parameterpublic void test(List<?> t) throws ParameterException
test
in interface ParameterConstraint<List<?>>
t
- Value to be checked whether or not it fulfills the underlying
parameter constraint.ParameterException,
- if the size of the list parameter given is not
equal to the list size constraint specified.ParameterException
- if the parameter to be tested does not
fulfill the parameter constraintpublic String getDescription(String parameterName)
ParameterConstraint
getDescription
in interface ParameterConstraint<List<?>>
parameterName
- the name of the parameter this constraint is used for