### Question:
IndexingHandler extends Handler { public void delete(RequestContext requestContext) throws RegistryException { final String id = requestContext.getResourcePath().getPath(); final int tenantId = CurrentSession.getTenantId(); new Thread(new Runnable() { int tid = tenantId; public void run() { try { deleteFromIndex(id, tid); } catch (SolrException e) { log.error("Could not delete file for Solr server", e); } catch (RegistryException e) { log.error("Could not delete file for Solr server", e); } } }).start(); }  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 testDelete() throws Exception { RequestContext requestContext = new RequestContext(registry, repository, versionRepository); requestContext.setResource(resource); requestContext.setResourcePath(new ResourcePath(regResourcePath)); IndexingHandler indexingHandler = new IndexingHandler(); SolrClient client = PowerMockito.mock(SolrClient.class); mockStatic(SolrClient.class); Whitebox.setInternalState(SolrClient.class, "instance", client); final String[] deletePath = new String[1]; Mockito.doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocationOnMock) throws Throwable { Object[] args = invocationOnMock.getArguments(); deletePath[0] = (String) args[0]; return null; } }).when(client).deleteFromIndex(anyString(), anyInt()); AsyncIndexer indexer = new AsyncIndexer(); Whitebox.setInternalState(IndexingHandler.class, "asyncIndexer", indexer); CurrentSession.setTenantId(-1234); indexingHandler.delete(requestContext); long timeDifference = 5000; long startTime = Calendar.getInstance().getTimeInMillis(); long endTime = Calendar.getInstance().getTimeInMillis(); while (deletePath[0] == null && timeDifference > (endTime - startTime)){ endTime = Calendar.getInstance().getTimeInMillis(); } assertEquals(regResourcePath, deletePath[0]); }