use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.
the class PatternInclusionsDependencyFilterTest method acceptTestCornerCases.
@Test
public void acceptTestCornerCases() {
NodeBuilder builder = new NodeBuilder();
builder.artifactId("testArtifact");
DependencyNode node = builder.build();
List<DependencyNode> parents = new LinkedList<DependencyNode>();
// Empty String, Empty List
assertTrue(accept(node, ""));
assertFalse(new PatternInclusionsDependencyFilter(new LinkedList<String>()).accept(node, parents));
assertFalse(new PatternInclusionsDependencyFilter((String[]) null).accept(node, parents));
assertFalse(new PatternInclusionsDependencyFilter((VersionScheme) null, "[1,10]").accept(node, parents));
}
use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.
the class DependencyFilterUtilsTest method testClasspathFilterCompileRuntime.
@Test
public void testClasspathFilterCompileRuntime() {
NodeBuilder builder = new NodeBuilder().artifactId("aid");
DependencyFilter filter = DependencyFilterUtils.classpathFilter("compile", "runtime");
assertTrue(filter.accept(builder.scope("compile").build(), PARENTS));
assertTrue(filter.accept(builder.scope("system").build(), PARENTS));
assertTrue(filter.accept(builder.scope("provided").build(), PARENTS));
assertTrue(filter.accept(builder.scope("runtime").build(), PARENTS));
assertFalse(filter.accept(builder.scope("test").build(), PARENTS));
}
use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.
the class DependencyFilterUtilsTest method testClasspathFilterRuntime.
@Test
public void testClasspathFilterRuntime() {
NodeBuilder builder = new NodeBuilder().artifactId("aid");
DependencyFilter filter = DependencyFilterUtils.classpathFilter("runtime");
assertTrue(filter.accept(builder.scope("compile").build(), PARENTS));
assertFalse(filter.accept(builder.scope("system").build(), PARENTS));
assertFalse(filter.accept(builder.scope("provided").build(), PARENTS));
assertTrue(filter.accept(builder.scope("runtime").build(), PARENTS));
assertFalse(filter.accept(builder.scope("test").build(), PARENTS));
}
use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.
the class DependencyFilterUtilsTest method testClasspathFilterCompile.
@Test
public void testClasspathFilterCompile() {
NodeBuilder builder = new NodeBuilder().artifactId("aid");
DependencyFilter filter = DependencyFilterUtils.classpathFilter("compile");
assertTrue(filter.accept(builder.scope("compile").build(), PARENTS));
assertTrue(filter.accept(builder.scope("system").build(), PARENTS));
assertTrue(filter.accept(builder.scope("provided").build(), PARENTS));
assertFalse(filter.accept(builder.scope("runtime").build(), PARENTS));
assertFalse(filter.accept(builder.scope("test").build(), PARENTS));
}
use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.
the class ExclusionDependencyFilterTest method acceptTest.
@Test
public void acceptTest() {
NodeBuilder builder = new NodeBuilder();
builder.groupId("com.example.test").artifactId("testArtifact");
List<DependencyNode> parents = new LinkedList<DependencyNode>();
String[] excludes;
excludes = new String[] { "com.example.test:testArtifact" };
assertFalse(new ExclusionsDependencyFilter(Arrays.asList(excludes)).accept(builder.build(), parents));
excludes = new String[] { "com.example.test:testArtifact", "com.foo:otherArtifact" };
assertFalse(new ExclusionsDependencyFilter(Arrays.asList(excludes)).accept(builder.build(), parents));
excludes = new String[] { "testArtifact" };
assertFalse(new ExclusionsDependencyFilter(Arrays.asList(excludes)).accept(builder.build(), parents));
excludes = new String[] { "otherArtifact" };
assertTrue(new ExclusionsDependencyFilter(Arrays.asList(excludes)).accept(builder.build(), parents));
assertTrue(new ExclusionsDependencyFilter((Collection<String>) null).accept(builder.build(), parents));
}
Aggregations