// Testing ConstraintAlternatives.create(Collection) method
logger.log(Level.FINE,
"+++ Testing ConstraintAlternatives.create(Collection) ...");
try {
InvocationConstraint res = ConstraintAlternatives.create(argC);
logger.log(Level.FINE, "Returned InvocationConstraint:: " + res);
// Compare with the expected InvocationConstraint object
if (!res.equals(ic)) {
logger.log(Level.FINE,
"Returned InvocationConstraint object"
+ " isn't equal to the expected one!");
return false;
}
// Verify that the argument hasn't been modified
if (!argC.equals(c)) {
logger.log(Level.FINE, "The argument has been modified!");
return false;
}
// Verify that the argument isn't retained, i.e. subsequent changes
// to the argument have no effect on the instance created
argC.clear();
if (!res.equals(ic)) {
logger.log(Level.FINE,
"The argument is retained, i.e. subsequent changes to"
+ " the argument have an effect on the instance"
+ " created");
return false;
}
} catch (Exception e) {
logger.log(Level.FINE,
"Exception has been thrown while invoking"
+ " ConstraintAlternatives.create(Collection) method: "
+ e);
return false;
}
// Testing ConstraintAlternatives.create(InvocationConstraint[]) method
logger.log(Level.FINE,
"+++ Testing"
+ " ConstraintAlternatives.create(InvocationConstraint[]) ...");
try {
InvocationConstraint res = ConstraintAlternatives.create(argA);
logger.log(Level.FINE, "Returned InvocationConstraint:: " + res);
// Compare with the expected InvocationConstraint object
if (!res.equals(ic)) {
logger.log(Level.FINE,
"Returned InvocationConstraint object"
+ " isn't equal to the expected one!");
return false;
}
// Verify that the argument hasn't been modified
if (!Arrays.equals(argA, argACopy)) {
logger.log(Level.FINE, "The argument has been modified!");
return false;
}
// Verify that the argument isn't retained, i.e. subsequent changes
// to the argument have no effect on the instance created
Arrays.fill(argA, null);
if (!res.equals(ic)) {
logger.log(Level.FINE,
"The argument is retained, i.e. subsequent changes to"
+ " the argument have an effect on the instance"
+ " created");
return false;