caelum/vraptor — pull request #580 by nykolaslima (2013-10-16 06:01:40+00:00)
Title: create #clearErrors in MockValidator to help in tests

I have some tests where a String should be not empty (!= null and size > 0).

Nowadays I need to do this:

String cepWithoutDash = "05594130";
address.setCep(cepWithoutDash);
address.validate(validator);
assertTrue(validator.containsMessage("validation.realEstate.invalidCep"));

validator = new MockValidator();
String cepWithMoreNumbersAfterDash = "05594-1301";
address.setCep(cepWithMoreNumbersAfterDash);
address.validate(validator);
assertTrue(validator.containsMessage("validation.realEstate.invalidCep"));

I need to create a new MockValidator to clear errors from first validation. With `clearErrors` method this tests can be easily created.