### Question:
MediaTypeFilter extends Filter { @Override public boolean handleDelete(RequestContext requestContext) throws RegistryException { Resource resource = requestContext.getResource(); if (resource == null) { resource = requestContext.getRepository().get(requestContext.getResourcePath().getPath()); requestContext.setResource(resource); } if (resource != null) { 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 handleDelete() throws Exception { RequestContext requestContext = new RequestContext(registry, repository, versionRepository); requestContext.setResource(resource); MediaTypeFilter filter = new MediaTypeFilter("application/(.)+\\+xml"); assertTrue(filter.handleDelete(requestContext)); requestContext.setResource(null); ResourcePath resourcePath = requestContext.getResourcePath(); if (resourcePath == null) { resourcePath = new ResourcePath("/_system/governance/trunk/soapservices/eu/dataaccess/footballpool/1.0.0" + "/Info"); requestContext.setResourcePath(resourcePath); } assertTrue(filter.handleDelete(requestContext)); }