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