@Test public void testValidacao() { CpfValidator validator = new CpfValidator(); PowerMock.mockStatic(CPF.class); EasyMock.expect(CPF.isValido(EasyMock.anyObject(String.class))).andReturn(true); PowerMock.replay(CPF.class); Assert.assertTrue(validator.isValid("12312312312", null)); PowerMock.verify(CPF.class); }
@Override public boolean isValid(String cpf, final ConstraintValidatorContext context) { boolean result = false; if ( cpf == null || "".equals(cpf) ) { result = true; } else { result = CPF.isValido(cpf); } return result; }
CpfValidator implements ConstraintValidator<Cpf, String> { @Override public boolean isValid(String cpf, final ConstraintValidatorContext context) { boolean result = false; if ( cpf == null || "".equals(cpf) ) { result = true; } else { result = CPF.isValido(cpf); } return result; } }
CpfValidator implements ConstraintValidator<Cpf, String> { @Override public boolean isValid(String cpf, final ConstraintValidatorContext context) { boolean result = false; if ( cpf == null || "".equals(cpf) ) { result = true; } else { result = CPF.isValido(cpf); } return result; }  }
CpfValidator implements ConstraintValidator<Cpf, String> { @Override public boolean isValid(String cpf, final ConstraintValidatorContext context) { boolean result = false; if ( cpf == null || "".equals(cpf) ) { result = true; } else { result = CPF.isValido(cpf); } return result; }  @Override void initialize(final Cpf constraintAnnotation); @Override boolean isValid(String cpf, final ConstraintValidatorContext context); }
CpfValidator implements ConstraintValidator<Cpf, String> { @Override public boolean isValid(String cpf, final ConstraintValidatorContext context) { boolean result = false; if ( cpf == null || "".equals(cpf) ) { result = true; } else { result = CPF.isValido(cpf); } return result; }  @Override void initialize(final Cpf constraintAnnotation); @Override boolean isValid(String cpf, final ConstraintValidatorContext context);  }