@Test public void execute() { AllRelatedNodesOperation allRelatedNodesOperation = new AllRelatedNodesOperation(graphOperations.getAllReachableEdges()); SetResult<Vertex> result = allRelatedNodesOperation.execute(builder.getGraph()); Set<Vertex> allRelatedNodes = result.get(); assertNotNull(allRelatedNodes); assertEquals(5, allRelatedNodes.size()); assertTrue(allRelatedNodes.contains(new Vertex.Builder("ClassA", "coveredMethod()").build())); assertTrue(allRelatedNodes.contains(new Vertex.Builder("ClassB", "callerMethod()").build())); assertTrue(allRelatedNodes.contains(new TestVertex.Builder("ClassBTest", "testCallerMethod()").build())); assertTrue(allRelatedNodes.contains(new TestVertex.Builder("ClassRTest", "testRelatedWithReflectionCall()").build())); assertTrue(allRelatedNodes.contains(new TestVertex.Builder("ClassRTest", "testRelatedWithoutReflectionCall()").build())); }
@Override public SetResult<Vertex> execute(Graph<Vertex, Edge> graph) { return new SetResult<>(emptyIfFalse(true, () -> allReachableEdges.stream() .flatMap(e -> Arrays.stream(new Vertex[]{e.getSource(), e.getTarget()})).filter(v -> !v.isSpecial()).distinct())); }
AllRelatedNodesOperation extends AbstractGraphOperation<SetResult<Vertex>> { @Override public SetResult<Vertex> execute(Graph<Vertex, Edge> graph) { return new SetResult<>(emptyIfFalse(true, () -> allReachableEdges.stream() .flatMap(e -> Arrays.stream(new Vertex[]{e.getSource(), e.getTarget()})).filter(v -> !v.isSpecial()).distinct())); } }
AllRelatedNodesOperation extends AbstractGraphOperation<SetResult<Vertex>> { @Override public SetResult<Vertex> execute(Graph<Vertex, Edge> graph) { return new SetResult<>(emptyIfFalse(true, () -> allReachableEdges.stream() .flatMap(e -> Arrays.stream(new Vertex[]{e.getSource(), e.getTarget()})).filter(v -> !v.isSpecial()).distinct())); } AllRelatedNodesOperation(Set<Edge> allReachableEdges); }
AllRelatedNodesOperation extends AbstractGraphOperation<SetResult<Vertex>> { @Override public SetResult<Vertex> execute(Graph<Vertex, Edge> graph) { return new SetResult<>(emptyIfFalse(true, () -> allReachableEdges.stream() .flatMap(e -> Arrays.stream(new Vertex[]{e.getSource(), e.getTarget()})).filter(v -> !v.isSpecial()).distinct())); } AllRelatedNodesOperation(Set<Edge> allReachableEdges); @Override SetResult<Vertex> execute(Graph<Vertex, Edge> graph); }
AllRelatedNodesOperation extends AbstractGraphOperation<SetResult<Vertex>> { @Override public SetResult<Vertex> execute(Graph<Vertex, Edge> graph) { return new SetResult<>(emptyIfFalse(true, () -> allReachableEdges.stream() .flatMap(e -> Arrays.stream(new Vertex[]{e.getSource(), e.getTarget()})).filter(v -> !v.isSpecial()).distinct())); } AllRelatedNodesOperation(Set<Edge> allReachableEdges); @Override SetResult<Vertex> execute(Graph<Vertex, Edge> graph);  }