ClientResource extends AbstractResource { protected String sanitizeClientName(String name) { return name.toLowerCase().replaceAll(" ", "-").replaceAll(FILTERED_CLIENT_ID_CHARS, ""); }  @GET Response getAll(@Context HttpServletRequest request,
                         @PathParam("resourceServerId") Long resourceServerId); @GET @Path("/{clientId}") Response getById(@Context HttpServletRequest request,
                          @PathParam("resourceServerId") Long resourceServerId,
                          @PathParam("clientId") Long id); @PUT Response put(@Context HttpServletRequest request,
                      @PathParam("resourceServerId") Long resourceServerId, Client client); @DELETE @Path("/{clientId}") Response delete(@Context HttpServletRequest request,
                         @PathParam("clientId") Long id,
                         @PathParam("resourceServerId") Long resourceServerId); @POST @Path("/{clientId}") Response post(@Valid Client newOne, @PathParam("clientId") Long id,
                       @Context HttpServletRequest request,
                       @PathParam("resourceServerId") Long resourceServerId
  );  }
@Test public void sanitize() { String sanitized = clientResource.sanitizeClientName("ab()();'$&* --- %(&^*c123"); assertEquals("ab-------c123", sanitized); sanitized = clientResource.sanitizeClientName("some nice client name"); assertEquals("some-nice-client-name", sanitized); sanitized = clientResource.sanitizeClientName("Some Nice Client-Name *%^$#''§`~"); assertEquals("some-nice-client-name-", sanitized); }