### Question:
MediaTypeFilter extends Filter { @Override public boolean handleGet(RequestContext requestContext) throws RegistryException { ResourcePath resourcePath = requestContext.getResourcePath(); if (resourcePath.parameterExists("new")) { String mediaType = resourcePath.getParameterValue("mediaType"); if (mediaType != null){ Matcher matcher = pattern.matcher(mediaType); return matcher.matches(); } } Resource resource = requestContext.getResource(); if (resource == null) { VersionedPath versionedPath = RegistryUtils.getVersionedPath(requestContext.getResourcePath()); if (versionedPath.getVersion() == -1) { 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 handleGet() throws Exception { RequestContext requestContext = new RequestContext(registry, repository, versionRepository); requestContext.setResource(resource); MediaTypeFilter filter = new MediaTypeFilter("application/(.)+\\+xml"); assertTrue(filter.handleGet(requestContext)); ResourcePath resourcePath = requestContext.getResourcePath(); if (resourcePath == null) { resourcePath = new ResourcePath("/_system/governance/trunk/soapservices/eu/dataaccess/footballpool/1.0.0" + "/Info"); } requestContext.setResource(null); assertTrue(filter.handleGet(requestContext)); resourcePath.setParameter("new", ""); resourcePath.setParameter("mediaType", "application/vnd.wso2-soap-service+xml"); assertTrue(filter.handleGet(requestContext)); resourcePath.setParameter("new", ""); resourcePath.setParameter("mediaType", "application/vnd.wso2-soap-service+json"); assertFalse(filter.handleGet(requestContext)); }