public void testRemoveValidators() {
DummyValidator val = new DummyValidator();
DummyValidator val2 = new DummyValidator();
ValidationProcessor proc = new DefaultValidationProcessor(null);
proc.addValidators("test", val);
proc.addValidators("test2", val2);
assertEquals("Two validators were added!", 2, proc.getValidatorCount());
proc.validate();
assertEquals("1 validation invocation occured!", 1, val.validationInvocationCount);
assertEquals("1 validation invocation occured!", 1, val2.validationInvocationCount);
assertEquals("0 action invocation occured!", 0, val.actionInvocationCount);
assertEquals("0 action invocation occured!", 0, val2.actionInvocationCount);
assertEquals("0 actionReset invocations occured!", 0, val.resetActionCount);
assertEquals("0 actionReset invocations occured!", 0, val2.resetActionCount);
proc.removeValidators("test2");
proc.validate();
assertEquals("2 validation invocation occured!", 2, val.validationInvocationCount);
assertEquals("1 validation invocation occured!", 1, val2.validationInvocationCount);
assertEquals("0 action invocation occured!", 0, val.actionInvocationCount);
assertEquals("0 action invocation occured!", 0, val2.actionInvocationCount);
assertEquals("1 actionReset invocations occured!", 1, val.resetActionCount);
assertEquals("0 actionReset invocations occured!", 0, val2.resetActionCount);
assertEquals("Only one validator is left!", 1, proc.getValidatorCount());
proc.removeAllValidators();
val.clearStats();
val2.clearStats();
proc.addValidators("test", val);
proc.addValidators("test2", val2);
assertEquals("Two validators were added!", 2, proc.getValidatorCount());
proc.validate();
assertEquals("1 validation invocation occured!", 1, val.validationInvocationCount);
assertEquals("1 validation invocation occured!", 1, val2.validationInvocationCount);
assertEquals("0 action invocation occured!", 0, val.actionInvocationCount);
assertEquals("0 action invocation occured!", 0, val2.actionInvocationCount);
assertEquals("0 actionReset invocations occured!", 0, val.resetActionCount);
assertEquals("0 actionReset invocations occured!", 0, val2.resetActionCount);
proc.removeValidators("test2");
proc.validate();
assertEquals("2 validation invocation occured!", 2, val.validationInvocationCount);
assertEquals("1 validation invocation occured!", 1, val2.validationInvocationCount);
assertEquals("0 action invocation occured!", 0, val.actionInvocationCount);
assertEquals("0 action invocation occured!", 0, val2.actionInvocationCount);
assertEquals("1 actionReset invocations occured!", 1, val.resetActionCount);
assertEquals("0 actionReset invocations occured!", 0, val2.resetActionCount);
assertEquals("Only one validator is left!", 1, proc.getValidatorCount());
}