ContentRest extends BaseRest { protected boolean validMimetype(String mimetype) { boolean valid = true; if (mimetype == null || mimetype.equals("")) { valid = false; } else { try { MediaType.valueOf(mimetype); } catch (IllegalArgumentException e) { valid = false; } } return valid; } @Autowired  ContentRest(ContentResource contentResource, RestUtil restUtil); @GET Response getContent(@PathParam("spaceID") String spaceID,
                               @PathParam("contentID") String contentID,
                               @QueryParam("storeID") String storeID,
                               @QueryParam("attachment") boolean attachment,
                               @HeaderParam(RANGE_HEADER) String range); @HEAD Response getContentProperties(@PathParam("spaceID") String spaceID,
                                         @PathParam("contentID") String contentID,
                                         @QueryParam("storeID") String storeID); @POST Response updateContentProperties(@PathParam("spaceID") String spaceID,
                                            @PathParam("contentID") String contentID,
                                            @QueryParam("storeID") String storeID); @PUT Response putContent(@PathParam("spaceID") String spaceID,
                               @PathParam("contentID") String contentID,
                               @QueryParam("storeID") String storeID,
                               @HeaderParam(COPY_SOURCE_HEADER) String copySource,
                               @HeaderParam(COPY_SOURCE_STORE_HEADER) String sourceStoreID); @DELETE Response deleteContent(@PathParam("spaceID") String spaceID,
                                  @PathParam("contentID") String contentID,
                                  @QueryParam("storeID") String storeID);  }
@Test public void testValidMimetype() { replayMocks(); contentRest = new ContentRest(null, null); assertTrue(contentRest.validMimetype("text/xml")); assertTrue(contentRest.validMimetype("application/xml")); assertTrue(contentRest.validMimetype("blah/blah")); assertFalse(contentRest.validMimetype("text*xml")); assertFalse(contentRest.validMimetype("***")); }