### Question:
RecursiveTreeIndexer { public void index(RepositoryObject repoObj, IndexingActionType actionType, String userid) throws IndexingException { PID pid = repoObj.getPid(); Set<String> types = repoObj.getResource().listProperties(RDF.type).toList().stream() .map(Statement::getResource) .map(Resource::getURI) .collect(Collectors.toSet()); index(pid, types, actionType, userid); } RecursiveTreeIndexer(); void index(RepositoryObject repoObj, IndexingActionType actionType, String userid); void setIndexingMessageSender(IndexingMessageSender messageSender); void setSparqlQueryService(SparqlQueryService queryService);  }### Answer:
@Test public void testNonContainer() throws Exception { FileObject fileObj = makeFileObject(makePid(), repositoryObjectLoader); indexer.index(fileObj, ADD, USER); verify(messageSender).sendIndexingOperation(eq(USER), pidCaptor.capture(), eq(IndexingActionType.ADD)); assertEquals(fileObj.getPid(), pidCaptor.getValue()); }
@Test public void testNoChildren() throws Exception { ContentContainerObject containerObj = makeContainer(makePid(), repositoryObjectLoader); indexer.index(containerObj, ADD, USER); verify(messageSender).sendIndexingOperation(eq(USER), pidCaptor.capture(), eq(IndexingActionType.ADD)); assertEquals(containerObj.getPid(), pidCaptor.getValue()); }
@Test public void testHierarchy() throws Exception { ContentContainerObject containerObj = makeContainer(makePid(), repositoryObjectLoader); ContentContainerObject child1Obj = makeContainer(makePid(), repositoryObjectLoader); FileObject fileObj = makeFileObject(makePid(), repositoryObjectLoader); ContentContainerObject child2Obj = makeContainer(makePid(), repositoryObjectLoader); addMembers(containerObj, child1Obj, child2Obj); addMembers(child1Obj, fileObj); indexTriples(containerObj, child1Obj, fileObj, child2Obj); indexer.index(containerObj, ADD, USER); verify(messageSender, times(4)).sendIndexingOperation(eq(USER), pidCaptor.capture(), eq(IndexingActionType.ADD)); List<PID> pids = pidCaptor.getAllValues(); assertTrue(pids.contains(containerObj.getPid())); assertTrue(pids.contains(child1Obj.getPid())); assertTrue(pids.contains(fileObj.getPid())); assertTrue(pids.contains(child2Obj.getPid())); }