@Test public void testIsAccepted() { DependencyGraph graph = DependencyGraphFactory.createGraph(); Node n1 = graph.getOrCreateNodeByName("v1"); Node n2 = graph.getOrCreateNodeByName("v2"); Node n3 = graph.getOrCreateNodeByName("v3"); graph.addDependency(n1, n2, DependencyType.READ_ONLY); graph.addDependency(n1, n3, DependencyType.CREATE); NodeHasOutgoingDependencyTypeFilter filter = new NodeHasOutgoingDependencyTypeFilter(graph, DependencyType.CREATE); assertThat(filter.isAccepted(n1)).isTrue(); assertThat(filter.isAccepted(n2)).isFalse(); assertThat(filter.isAccepted(n3)).isFalse(); }
@Override public boolean isAccepted(Node node) { return dependencyGraph.getOutgoingEdges(node).stream().anyMatch(dep -> dep.getDependencyType() == dependencyType); }
NodeHasOutgoingDependencyTypeFilter implements NodeFilter { @Override public boolean isAccepted(Node node) { return dependencyGraph.getOutgoingEdges(node).stream().anyMatch(dep -> dep.getDependencyType() == dependencyType); } }
NodeHasOutgoingDependencyTypeFilter implements NodeFilter { @Override public boolean isAccepted(Node node) { return dependencyGraph.getOutgoingEdges(node).stream().anyMatch(dep -> dep.getDependencyType() == dependencyType); } NodeHasOutgoingDependencyTypeFilter(DependencyGraph dependencyGraph, DependencyType dependencyType); }
NodeHasOutgoingDependencyTypeFilter implements NodeFilter { @Override public boolean isAccepted(Node node) { return dependencyGraph.getOutgoingEdges(node).stream().anyMatch(dep -> dep.getDependencyType() == dependencyType); } NodeHasOutgoingDependencyTypeFilter(DependencyGraph dependencyGraph, DependencyType dependencyType); @Override boolean isAccepted(Node node); }
NodeHasOutgoingDependencyTypeFilter implements NodeFilter { @Override public boolean isAccepted(Node node) { return dependencyGraph.getOutgoingEdges(node).stream().anyMatch(dep -> dep.getDependencyType() == dependencyType); } NodeHasOutgoingDependencyTypeFilter(DependencyGraph dependencyGraph, DependencyType dependencyType); @Override boolean isAccepted(Node node);  }