### Question:
MediaTypeFilter extends Filter { @Override public boolean handlePut(RequestContext requestContext) throws RegistryException { Resource resource = requestContext.getResource(); if (resource == null) { return false; } String mType = resource.getMediaType(); if (mType != null){ Matcher matcher = pattern.matcher(mType); return matcher.matches(); } return false; } MediaTypeFilter();  MediaTypeFilter(String mediaTypeRegEx); String getMediaTypeRegEx(); void setMediaTypeRegEx(String mediaTypeRegEx); int hashCode(); boolean equals(Object other); @Override boolean handleGet(RequestContext requestContext); @Override boolean handlePut(RequestContext requestContext); @Override boolean handleImportResource(RequestContext requestContext); @Override boolean handleDelete(RequestContext requestContext); @Override boolean handlePutChild(RequestContext requestContext); @Override boolean handleImportChild(RequestContext requestContext);  }### Answer:
@Test public void handlePut() throws Exception { RequestContext requestContext = new RequestContext(registry, repository, versionRepository); requestContext.setResource(resource); MediaTypeFilter filter = new MediaTypeFilter("application/(.)+\\+xml"); assertTrue(filter.handlePut(requestContext)); requestContext.setResource(null); assertFalse(filter.handlePut(requestContext)); }