@Test public void validateMinimalistic() { Set<ConstraintViolation<ResourceServer>> violations = validator.validate(resourceServer); assertEquals("minimal resource server should have no violations", 0, violations.size()); }
@Override public boolean validate(ConstraintValidatorContext context) { boolean isValid = true; for (String scope : scopes) { if (!scope.matches(ResourceServer.SCOPE_PATTERN)) { violation(context, "Scope '" + scope + "' contains invalid characters"); isValid = false; } } return isValid; }
ResourceServer extends AbstractEntity { @Override public boolean validate(ConstraintValidatorContext context) { boolean isValid = true; for (String scope : scopes) { if (!scope.matches(ResourceServer.SCOPE_PATTERN)) { violation(context, "Scope '" + scope + "' contains invalid characters"); isValid = false; } } return isValid; } }
ResourceServer extends AbstractEntity { @Override public boolean validate(ConstraintValidatorContext context) { boolean isValid = true; for (String scope : scopes) { if (!scope.matches(ResourceServer.SCOPE_PATTERN)) { violation(context, "Scope '" + scope + "' contains invalid characters"); isValid = false; } } return isValid; }  }
ResourceServer extends AbstractEntity { @Override public boolean validate(ConstraintValidatorContext context) { boolean isValid = true; for (String scope : scopes) { if (!scope.matches(ResourceServer.SCOPE_PATTERN)) { violation(context, "Scope '" + scope + "' contains invalid characters"); isValid = false; } } return isValid; }  String getName(); void setName(String name); List<String> getScopes(); void setScopes(List<String> scopes); String getSecret(); void setSecret(String secret); String getContactName(); void setContactName(String contactName); String getContactEmail(); void setContactEmail(String contactEmail); String getThumbNailUrl(); void setThumbNailUrl(String thumbNailUrl); void setOwner(String owner); String getOwner(); String getKey(); void setKey(String key); Set<Client> getClients(); void setClients(Set<Client> clients); String getDescription(); void setDescription(String description); boolean containsClient(Client client); @Override boolean validate(ConstraintValidatorContext context); }
ResourceServer extends AbstractEntity { @Override public boolean validate(ConstraintValidatorContext context) { boolean isValid = true; for (String scope : scopes) { if (!scope.matches(ResourceServer.SCOPE_PATTERN)) { violation(context, "Scope '" + scope + "' contains invalid characters"); isValid = false; } } return isValid; }  String getName(); void setName(String name); List<String> getScopes(); void setScopes(List<String> scopes); String getSecret(); void setSecret(String secret); String getContactName(); void setContactName(String contactName); String getContactEmail(); void setContactEmail(String contactEmail); String getThumbNailUrl(); void setThumbNailUrl(String thumbNailUrl); void setOwner(String owner); String getOwner(); String getKey(); void setKey(String key); Set<Client> getClients(); void setClients(Set<Client> clients); String getDescription(); void setDescription(String description); boolean containsClient(Client client); @Override boolean validate(ConstraintValidatorContext context); static final String SCOPE_PATTERN; }