@Test public void testValidValue() { when(params.getVersion()).thenReturn(PdfVersion.VERSION_1_5); when(params.getMinRequiredPdfVersion()).thenReturn(PdfVersion.VERSION_1_2); assertTrue(victim.isValid(params, null)); }
@Override public boolean isValid(AbstractPdfOutputParameters value, ConstraintValidatorContext context) { boolean isValid = value == null || value.getVersion() == null || value.getVersion().compareTo(value.getMinRequiredPdfVersion()) >= 0; if (!isValid) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate( String.format("Invalid version %s. Minimum version required is %s.", value.getVersion(), value.getMinRequiredPdfVersion())).addNode("parameters").addConstraintViolation(); } return isValid; }
PdfVersionValidator implements ConstraintValidator<ValidPdfVersion, AbstractPdfOutputParameters> { @Override public boolean isValid(AbstractPdfOutputParameters value, ConstraintValidatorContext context) { boolean isValid = value == null || value.getVersion() == null || value.getVersion().compareTo(value.getMinRequiredPdfVersion()) >= 0; if (!isValid) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate( String.format("Invalid version %s. Minimum version required is %s.", value.getVersion(), value.getMinRequiredPdfVersion())).addNode("parameters").addConstraintViolation(); } return isValid; } }
PdfVersionValidator implements ConstraintValidator<ValidPdfVersion, AbstractPdfOutputParameters> { @Override public boolean isValid(AbstractPdfOutputParameters value, ConstraintValidatorContext context) { boolean isValid = value == null || value.getVersion() == null || value.getVersion().compareTo(value.getMinRequiredPdfVersion()) >= 0; if (!isValid) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate( String.format("Invalid version %s. Minimum version required is %s.", value.getVersion(), value.getMinRequiredPdfVersion())).addNode("parameters").addConstraintViolation(); } return isValid; }  }
PdfVersionValidator implements ConstraintValidator<ValidPdfVersion, AbstractPdfOutputParameters> { @Override public boolean isValid(AbstractPdfOutputParameters value, ConstraintValidatorContext context) { boolean isValid = value == null || value.getVersion() == null || value.getVersion().compareTo(value.getMinRequiredPdfVersion()) >= 0; if (!isValid) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate( String.format("Invalid version %s. Minimum version required is %s.", value.getVersion(), value.getMinRequiredPdfVersion())).addNode("parameters").addConstraintViolation(); } return isValid; }  @Override void initialize(ValidPdfVersion constraintAnnotation); @Override boolean isValid(AbstractPdfOutputParameters value, ConstraintValidatorContext context); }
PdfVersionValidator implements ConstraintValidator<ValidPdfVersion, AbstractPdfOutputParameters> { @Override public boolean isValid(AbstractPdfOutputParameters value, ConstraintValidatorContext context) { boolean isValid = value == null || value.getVersion() == null || value.getVersion().compareTo(value.getMinRequiredPdfVersion()) >= 0; if (!isValid) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate( String.format("Invalid version %s. Minimum version required is %s.", value.getVersion(), value.getMinRequiredPdfVersion())).addNode("parameters").addConstraintViolation(); } return isValid; }  @Override void initialize(ValidPdfVersion constraintAnnotation); @Override boolean isValid(AbstractPdfOutputParameters value, ConstraintValidatorContext context);  }