@Test public void acceptTest() { NodeBuilder builder = new NodeBuilder(); builder.scope( "compile" ).artifactId( "test" ); List<DependencyNode> parents = new LinkedList<DependencyNode>(); assertTrue( new ScopeDependencyFilter( null, null ).accept( builder.build(), parents ) ); assertTrue( new ScopeDependencyFilter( new LinkedList<String>(), new LinkedList<String>() ).accept( builder.build(), parents ) ); assertTrue( new ScopeDependencyFilter( (String[]) null ).accept( builder.build(), parents ) ); assertTrue( new ScopeDependencyFilter( "test" ).accept( builder.build(), parents ) ); assertFalse( new ScopeDependencyFilter( "compile" ).accept( builder.build(), parents ) ); assertFalse( new ScopeDependencyFilter( "compile", "test" ).accept( builder.build(), parents ) ); String[] excludes1 = { "provided" }; String[] includes1 = { "compile", "test" }; assertTrue( new ScopeDependencyFilter( Arrays.asList( includes1 ), Arrays.asList( excludes1 ) ).accept( builder.build(), parents ) ); assertTrue( new ScopeDependencyFilter( Arrays.asList( includes1 ), null ).accept( builder.build(), parents ) ); String[] excludes2 = { "compile" }; String[] includes2 = { "compile" }; assertFalse( new ScopeDependencyFilter( Arrays.asList( includes2 ), Arrays.asList( excludes2 ) ).accept( builder.build(), parents ) ); }
public boolean accept( DependencyNode node, List<DependencyNode> parents ) { Dependency dependency = node.getDependency(); if ( dependency == null ) { return true; } String scope = node.getDependency().getScope(); return ( included.isEmpty() || included.contains( scope ) ) && ( excluded.isEmpty() || !excluded.contains( scope ) ); }
ScopeDependencyFilter implements DependencyFilter { public boolean accept( DependencyNode node, List<DependencyNode> parents ) { Dependency dependency = node.getDependency(); if ( dependency == null ) { return true; } String scope = node.getDependency().getScope(); return ( included.isEmpty() || included.contains( scope ) ) && ( excluded.isEmpty() || !excluded.contains( scope ) ); } }
ScopeDependencyFilter implements DependencyFilter { public boolean accept( DependencyNode node, List<DependencyNode> parents ) { Dependency dependency = node.getDependency(); if ( dependency == null ) { return true; } String scope = node.getDependency().getScope(); return ( included.isEmpty() || included.contains( scope ) ) && ( excluded.isEmpty() || !excluded.contains( scope ) ); } ScopeDependencyFilter( Collection<String> included, Collection<String> excluded );  ScopeDependencyFilter( String... excluded ); }
ScopeDependencyFilter implements DependencyFilter { public boolean accept( DependencyNode node, List<DependencyNode> parents ) { Dependency dependency = node.getDependency(); if ( dependency == null ) { return true; } String scope = node.getDependency().getScope(); return ( included.isEmpty() || included.contains( scope ) ) && ( excluded.isEmpty() || !excluded.contains( scope ) ); } ScopeDependencyFilter( Collection<String> included, Collection<String> excluded );  ScopeDependencyFilter( String... excluded ); boolean accept( DependencyNode node, List<DependencyNode> parents ); @Override boolean equals( Object obj ); @Override int hashCode(); }
ScopeDependencyFilter implements DependencyFilter { public boolean accept( DependencyNode node, List<DependencyNode> parents ) { Dependency dependency = node.getDependency(); if ( dependency == null ) { return true; } String scope = node.getDependency().getScope(); return ( included.isEmpty() || included.contains( scope ) ) && ( excluded.isEmpty() || !excluded.contains( scope ) ); } ScopeDependencyFilter( Collection<String> included, Collection<String> excluded );  ScopeDependencyFilter( String... excluded ); boolean accept( DependencyNode node, List<DependencyNode> parents ); @Override boolean equals( Object obj ); @Override int hashCode();  }