### Question:
IndexingHandler extends Handler { public void importResource(RequestContext requestContext) throws RegistryException { if (isIndexable(requestContext)) { return; } PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); String path = getRegistryPath(requestContext); submitFileForIndexing(getIndexer(), requestContext.getResource(), path, requestContext.getSourceURL(), carbonContext.getTenantId(), carbonContext.getTenantDomain()); }  void put(RequestContext requestContext); @Override Collection searchContent(RequestContext requestContext); void importResource(RequestContext requestContext); void delete(RequestContext requestContext); void putChild(RequestContext requestContext); void importChild(RequestContext requestContext);  }### Answer:
@Test public void importResource() throws Exception { RequestContext requestContext = new RequestContext(registry, repository, versionRepository); requestContext.setResource(resource); IndexingHandler indexingHandler = new IndexingHandler(); SolrClient client = PowerMockito.mock(SolrClient.class); mockStatic(SolrClient.class); Whitebox.setInternalState(SolrClient.class, "instance", client); final IndexDocument[] documents = new IndexDocument[1]; Mockito.doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocationOnMock) throws Throwable { Object[] args = invocationOnMock.getArguments(); documents[0] = (IndexDocument) args[0]; return null; } }).when(client).addDocument((IndexDocument) anyObject()); try { PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(-1234, true); indexingHandler.importResource(requestContext); } finally { PrivilegedCarbonContext.endTenantFlow(); } assertNotNull(documents[0]); assertEquals(regResourcePath, documents[0].getPath()); }