Skip to content

Instantly share code, notes, and snippets.

@gastaldi
Created June 9, 2011 15:18
Show Gist options
  • Save gastaldi/1016948 to your computer and use it in GitHub Desktop.
Save gastaldi/1016948 to your computer and use it in GitHub Desktop.
Forge Maven hasDependency Test
import static org.junit.Assert.assertTrue;
import org.jboss.forge.project.Project;
import org.jboss.forge.project.dependencies.DependencyBuilder;
import org.jboss.forge.project.facets.DependencyFacet;
import org.jboss.forge.test.AbstractShellTest;
import org.junit.Before;
import org.junit.Test;
public class MavenDependencyTest extends AbstractShellTest
{
Project project;
@Before
public void setUp() throws Exception
{
project = initializeJavaProject();
}
@Test
public void testHasDependencyBehavior() throws Exception
{
DependencyFacet dependencyFacet = project.getFacet(DependencyFacet.class);
DependencyBuilder forgeShellApiDependency = DependencyBuilder.create().setGroupId("org.jboss.forge")
.setArtifactId("forge-shell-api").setVersion("1.0.0-SNAPSHOT");
DependencyBuilder cdiDependency = DependencyBuilder.create().setGroupId("javax.enterprise")
.setArtifactId("cdi-api");
dependencyFacet.addDependency(forgeShellApiDependency);
assertTrue(dependencyFacet.hasDependency(cdiDependency));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment