@Test public void validate() { assertThat(new ConfigurationProperty("", "", "").validate("")).isEmpty(); assertThat(new ConfigurationProperty("", "", "").validate("foo")).isEmpty(); ConfigurationProperty property = new ConfigurationProperty("", "", "foo", new ValidationCallback() { @Override public String validate(String newValueCandidate) { return "foo".equals(newValueCandidate) ? "" : "Only the value \"foo\" is allowed."; } }); assertThat(property.validate("")).isEqualTo("Only the value \"foo\" is allowed."); assertThat(property.validate("foo")).isEmpty(); assertThat(property.validate("bar")).isEqualTo("Only the value \"foo\" is allowed."); }
public String validate(String newValueCandidate) { return validationCallback.validate(newValueCandidate); }
ConfigurationProperty { public String validate(String newValueCandidate) { return validationCallback.validate(newValueCandidate); } }
ConfigurationProperty { public String validate(String newValueCandidate) { return validationCallback.validate(newValueCandidate); } ConfigurationProperty(String name, String description, String defaultValue);  ConfigurationProperty(String name, String description, String defaultValue, ValidationCallback validationCallback); }
ConfigurationProperty { public String validate(String newValueCandidate) { return validationCallback.validate(newValueCandidate); } ConfigurationProperty(String name, String description, String defaultValue);  ConfigurationProperty(String name, String description, String defaultValue, ValidationCallback validationCallback); String getName(); String getDescription(); String validate(String newValueCandidate); void setValue(String value); String getValue(); }
ConfigurationProperty { public String validate(String newValueCandidate) { return validationCallback.validate(newValueCandidate); } ConfigurationProperty(String name, String description, String defaultValue);  ConfigurationProperty(String name, String description, String defaultValue, ValidationCallback validationCallback); String getName(); String getDescription(); String validate(String newValueCandidate); void setValue(String value); String getValue();  }