### Question:
SolrIngestProcessor implements Processor { @Override public void process(Exchange exchange) throws Exception { final Message in = exchange.getIn(); String fcrepoUri = (String) in.getHeader(FCREPO_URI); List<PID> targetPids = new ArrayList<>(); PID targetPid = PIDs.get(fcrepoUri); String resourceTypes = (String) in.getHeader(FCREPO_RESOURCE_TYPE); if (resourceTypes != null && resourceTypes.contains(Fcrepo4Repository.Binary.getURI())) { targetPid = PIDs.get(targetPid.getId()); FileObject parentFile = repoObjLoader.getFileObject(targetPid); RepositoryObject grandParent = parentFile.getParent(); if (grandParent instanceof WorkObject) { targetPids.add(grandParent.getPid()); } } targetPids.add(targetPid); log.debug("Indexing objects {}", targetPids); for (PID pid: targetPids) { SolrUpdateRequest updateRequest = new SolrUpdateRequest( pid.getRepositoryPath(), IndexingActionType.ADD); DocumentIndexingPackage dip = factory.createDip(pid); updateRequest.setDocumentIndexingPackage(dip); pipeline.process(dip); solrUpdateDriver.addDocument(dip.getDocument()); } } SolrIngestProcessor(DocumentIndexingPackageFactory factory,
            DocumentIndexingPipeline pipeline, SolrUpdateDriver solrUpdateDriver,
            RepositoryObjectLoader repoObjLoader); @Override void process(Exchange exchange);  }### Answer:
@Test public void testIndexObject() throws Exception { processor.process(exchange); verify(pipeline).process(eq(dip)); verify(solrUpdateDriver).addDocument(eq(docBean)); }
@Test(expected = IndexingException.class) public void testIndexingFailed() throws Exception { doThrow(new IndexingException("Fail")).when(pipeline).process(any(DocumentIndexingPackage.class)); processor.process(exchange); }