### Question:
StringValidationRule extends SchemaValidationRule<String> { @Override public void apply(String value) throws ValidationException { if (this.minLength.isPresent()) { if (value.length() < this.minLength.get()) { throw ValidationExceptionBuilder .stringRuleExceptionBuilder() .failingLowerBound() .withValue(value) .withBound(minLength.get().toString()) .build(); } } if (this.maxLength.isPresent()) { if (value.length() > this.maxLength.get()) { throw ValidationExceptionBuilder .stringRuleExceptionBuilder() .failingUpperBound() .withValue(value) .withBound(maxLength.get().toString()) .build(); } } if (this.enumList.isPresent()) { final boolean match = this.enumList .get() .stream() .anyMatch(e -> e.equals(value)); if (!match) throw ValidationExceptionBuilder .stringRuleExceptionBuilder() .failingRangeBound() .withValue(value) .withBound(buildList(enumList.get())) .build(); } return; } private  StringValidationRule(); @Override void apply(String value); static StringValidationRule.Builder stringValidationRuleBuilder(); Optional<Integer> getMinLength(); Optional<Integer> getMaxLength(); Optional<List<String>> getEnumList(); Optional<String> getFormat(); Optional<String> getPattern();  }### Answer:
@Test(expected = ValidationException.class) public void testMinLength() throws ValidationException { stringValidationRule.apply("ab"); }
@Test(expected = ValidationException.class) public void testMaxLength() throws ValidationException { stringValidationRule.apply("ababababa"); }
@Test(expected = ValidationException.class) public void testEnumValidation() throws ValidationException { stringValidationRule.apply("value3"); }
@Test public void testAllRulesPass() throws ValidationException { stringValidationRule.apply("value1"); }