Skip to content

Commit

Permalink
Fix GradleDependencyFacetTest
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-wyluda committed Aug 16, 2013
1 parent a56387a commit 986e0c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ public void testGetDirectDependency()
assertEquals("junit", dep.getCoordinate().getGroupId());
assertEquals("junit", dep.getCoordinate().getArtifactId());
assertEquals("4.11", dep.getCoordinate().getVersion());
assertEquals("testCompile", dep.getScopeType());
assertEquals("test", dep.getScopeType());
}

@Test
public void testGetDirectDependencyOnManaged()
{
Dependency dep = facet.getDirectDependency(DependencyBuilder.create("org.group:name:1.0-SNAPSHOT"));
Dependency dep = facet.getDirectDependency(DependencyBuilder.create("org.apache.commons:commons-exec:1.1"));

assertNull(dep);
}
Expand Down Expand Up @@ -207,17 +207,16 @@ public void testGetEffectiveDependenciesTransitive()
}

@Test
public void testGetEffectiveDependenciesInScopes()
public void testGetEffectiveDependenciesInScopesNonTransitive()
{
List<Dependency> deps = facet.getEffectiveDependenciesInScopes("test", "runtime");

ProjectAssert.assertNotContainsDependency(deps, "compile", "org.slf4j", "slf4j-api", "1.7.5");
ProjectAssert.assertNotContainsDependency(deps, "compile", "org.slf4j", "slf4j-simple", "1.7.5");
ProjectAssert.assertContainsDependency(deps, "test", "junit", "junit", "4.11");
ProjectAssert.assertContainsDependency(deps, "runtime", "com.google.code.guice", "guice", "1.0");

ProjectAssert.assertNotContainsDependency(deps, "runtime", "org.jboss.netty", "netty", "3.2.9.Final");
ProjectAssert.assertNotContainsDependency(deps, "test", "org.mockito", "mockito-all", "1.9.5");
ProjectAssert.assertContainsDependency(deps, "runtime", "org.jboss.netty", "netty", "3.2.9.Final");
ProjectAssert.assertContainsDependency(deps, "test", "org.mockito", "mockito-all", "1.9.5");
}

@Test
Expand All @@ -236,15 +235,15 @@ public void testGetEffectiveManagedDependency()
Dependency dep = facet.getEffectiveManagedDependency(DependencyBuilder.create("org.mockito:mockito-all:1.9.5"));

assertNotNull(dep);
assertEquals("runtime", dep.getScopeType());
assertEquals("test", dep.getScopeType());
}

@Test
public void testGetManagedDependencies()
{
List<Dependency> deps = facet.getManagedDependencies();

ProjectAssert.assertContainsDependency(deps, "compile", "org.group", "name", "1.0-SNAPSHOT");
ProjectAssert.assertContainsDependency(deps, "compile", "org.apache.commons", "commons-exec", "1.1");
ProjectAssert.assertContainsDependency(deps, "runtime", "org.codehaus.groovy", "groovy", "2.1.6");
ProjectAssert.assertNotContainsDependency(deps, "testCompile", "org.mockito", "mockito-all", "1.9.5");
}
Expand Down Expand Up @@ -296,7 +295,7 @@ public void tastHasEffectiveDependencyNot()
public void testHasEffectiveManagedDependency()
{
assertTrue(facet.hasEffectiveManagedDependency(
DependencyBuilder.create("make.managed:x:3.0")));
DependencyBuilder.create("org.mockito:mockito-all:1.9.5")));
}

@Test
Expand Down Expand Up @@ -350,7 +349,7 @@ public void testRemoveDependency()
@Test
public void testRemoveManagedDependency()
{
Dependency dep = DependencyBuilder.create("org.group:name:1.0-SNAPSHOT");
Dependency dep = DependencyBuilder.create("org.apache.commons:commons-exec:1.1");
assertTrue(facet.hasDirectManagedDependency(dep));

facet.removeManagedDependency(dep);
Expand All @@ -359,7 +358,8 @@ public void testRemoveManagedDependency()
DependencyFacet sameFacet = sameProject.getFacet(DependencyFacet.class);
List<Dependency> managedDeps = sameFacet.getManagedDependencies();

ProjectAssert.assertNotContainsDependency(managedDeps, "compile", "org.group", "name", "1.0-SNAPSHOT");
ProjectAssert.assertNotContainsDependency(managedDeps, "compile",
"org.apache.commons", "commons-exec", "1.1");
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion tests/src/test/resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ dependencies {

allprojects {
dependencies {
managed group: 'org.group', name: 'name', version: '1.0-SNAPSHOT', config: 'compile'
managed group: 'org.apache.commons', name: 'commons-exec', version: '1.1', config: 'compile'
}
}

Expand Down

0 comments on commit 986e0c6

Please sign in to comment.