### Question:
OperationFeederImpl implements OperationFeeder { public VisitOperationResult operationResult() { OperationIterator opIterator = operationsPipeline.iterator(); while (opIterator.hasNext()) { Operation operation = opIterator.next(); try { if (operation instanceof CreateEntity) { repository.visit((CreateEntity) operation); } else if (operation instanceof CreateRelationship) { repository.visit((CreateRelationship) operation); } else if (operation instanceof GetBatchEntityByID) { repository.visit((GetBatchEntityByID) operation); } else if (operation instanceof GetEntityByID) { repository.visit((GetEntityByID) operation); } else if (operation instanceof GetEntityByProperty) { repository.visit((GetEntityByProperty) operation); } else if (operation instanceof UpdateEntity) { repository.visit((UpdateEntity) operation); } else if (operation instanceof UpdateRelationship) { repository.visit((UpdateRelationship) operation); } else if (operation instanceof GraphTerminalOperation) { repository.visit((GraphTerminalOperation) operation); } else if (operation instanceof SelectEntities) { repository.visit((SelectEntities) operation); } else if (operation instanceof SelectRelationships) { repository.visit((SelectRelationships) operation); } else if (operation instanceof DeleteEntity) { repository.visit((DeleteEntity)operation); } else if(operation instanceof DeleteRelationship) { repository.visit((DeleteRelationship)operation); } LOG.info("SUCCESS " + operation.toString()); } catch (RepositoryException e) { LOG.error("FAIL " + operation.toString() + " with error message \" " + e.getMessage() + " \""); throw e; } } return repository.getResult(); } @Inject  OperationFeederImpl(GraphVisitor repository,
            @Assisted OperationPipeline operationsPipeline); VisitOperationResult operationResult();  }### Answer:
@Test public void testOperationFeederImplWithVariousOperations(){ GraphVisitor repository = new MockGraphVisitor(); OperationPipeline operationPipeline = new OperationPipeline(); OperationFeederImpl operationFeederImpl = new OperationFeederImpl(repository , operationPipeline); NewEntity newEntity = NewEntity.newInstance(Entity.ID.valueOf("entity-test")).build(); operationPipeline.add(new CreateEntity(newEntity)); ID sourceId = Entity.ID.valueOf("source-id"); ID targetId = Entity.ID.valueOf("target-id"); Name relationshipName = Relationship.Name.valueOf("test-name"); NewRelationship newRelationship = NewRelationship.between(sourceId, targetId).withLabel(relationshipName).build(); operationPipeline.add(new CreateRelationship(newRelationship)); List<ID> entityIds = new ArrayList<ID>(Arrays.asList(sourceId, targetId)); operationPipeline.add(new GetBatchEntityByID(entityIds )); operationPipeline.add(new GetEntityByID(sourceId)); operationPipeline.add(new GetEntityByProperty(Attribute.Name.valueOf("test-property"),"test")); Entity entity = new GraphEntity.Builder().setID(sourceId).build(); operationPipeline.add(new UpdateEntity(entity, null)); Relationship relationship = new GraphRelationship.Builder().setName(relationshipName).setSourceID(sourceId) .setTargetID(targetId).build(); operationPipeline.add(new UpdateRelationship(relationship , null)); operationPipeline.add(new GraphTerminalOperation()); operationPipeline.add(new SelectEntities(relationshipName, Direction.IN_OUT)); operationPipeline.add(new SelectRelationships(relationshipName, Direction.IN_OUT)); operationPipeline.add(new DeleteEntity(entity)); operationPipeline.add(new DeleteRelationship(relationship)); try{ VisitOperationResult result = operationFeederImpl.operationResult(); assertNotNull(result); }catch(Exception e){ fail("Shouldn't throw"); } }
@Test public void testOperationThatThrowsException(){ GraphVisitor repository = new TestGraphVisitor(); try{ OperationPipeline operationPipeline = new OperationPipeline(); OperationFeederImpl operationFeederImpl = new OperationFeederImpl(repository , operationPipeline); NewEntity newEntity = NewEntity.newInstance(Entity.ID.valueOf("entity-test")).build(); operationPipeline.add(new CreateEntity(newEntity)); VisitOperationResult result = operationFeederImpl.operationResult(); }catch(Exception e){ assertTrue(e instanceof RepositoryException); } }