### Question:
MediaTypeFilter extends Filter { @Override public boolean handleImportChild(RequestContext requestContext) throws RegistryException { Collection parentCollection = requestContext.getParentCollection(); if (parentCollection == null) { String parentPath = requestContext.getParentPath(); if (parentPath == null) { parentPath = RegistryUtils. getParentPath(requestContext.getResourcePath().getPath()); requestContext.setParentPath(parentPath); } VersionedPath versionedPath = RegistryUtils.getVersionedPath(requestContext.getResourcePath()); if (versionedPath.getVersion() == -1) { parentCollection = (Collection) requestContext.getRepository().get(parentPath); requestContext.setParentCollection(parentCollection); } } if (parentCollection != null) { String parentMediaType = parentCollection.getMediaType(); if (parentMediaType != null){ Matcher matcher = pattern.matcher(parentMediaType); 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 handleImportChild() throws Exception { Collection collection = new CollectionImpl(); collection.setMediaType(null); when(repository.get("/_system/governance/trunk/soapservices/eu/dataaccess/footballpool/1.0.0")) .thenReturn(collection); RequestContext requestContext = new RequestContext(registry, repository, versionRepository); requestContext.setResource(resource); MediaTypeFilter filter = new MediaTypeFilter("application/(.)+\\+xml"); assertFalse(filter.handleImportChild(requestContext)); collection.setMediaType("application/vnd.wso2-soap-service+xml"); assertTrue(filter.handleImportChild(requestContext)); }