### Question:
AcceptAnyValidator implements Validator<String> { public void assertValid(String value) { List<ValidationMessage> invalidMessages = invalidMessagesFor(value); if (!invalidMessages.isEmpty()) { throw new InvalidStateException(invalidMessages); } } AcceptAnyValidator(Documento... documentos);  AcceptAnyValidator(boolean isFormatted, Documento... documentos);  AcceptAnyValidator(MessageProducer messageProducer, boolean isFormatted, Documento... documentos); void assertValid(String value); List<ValidationMessage> invalidMessagesFor(String value); boolean isEligible(String object); @Override String generateRandomValid();  }### Answer:
@Test public void testAssertValidForCpf() { Validator<String> validator = new AcceptAnyValidator(Documento.CPF); String cpf = "336.397.038-20"; validator.assertValid(cpf); }
@Test public void testAssertValidForCnpj() { Validator<String> validator = new AcceptAnyValidator(Documento.CNPJ); String cnpj = "26.637.142/0001-58"; validator.assertValid(cnpj); }
@Test(expected = InvalidStateException.class) public void testAssertValidForInvalidCpf() { Validator<String> validator = new AcceptAnyValidator(Documento.CPF); String cpf = "336.397.038-22"; validator.assertValid(cpf); }
@Test(expected = InvalidStateException.class) public void testAssertValidForInvalidCnpj() { Validator<String> validator = new AcceptAnyValidator(Documento.CNPJ); String cnpj = "26.637.142/0001-57"; validator.assertValid(cnpj); }
@Test public void testAssertValidForUnformatedCpf() { Validator<String> validator = new AcceptAnyValidator(false, Documento.CPF); String cpf = "33639703820"; validator.assertValid(cpf); }
@Test public void testAssertValidForUnformatedCnpj() { Validator<String> validator = new AcceptAnyValidator(false, Documento.CNPJ); String cnpj = "26637142000158"; validator.assertValid(cnpj); }