Skip to content

Instantly share code, notes, and snippets.

@mojavelinux
Created April 15, 2012 15:09
Show Gist options
  • Select an option

  • Save mojavelinux/2393347 to your computer and use it in GitHub Desktop.

Select an option

Save mojavelinux/2393347 to your computer and use it in GitHub Desktop.
Basic Arquillian Test
import static org.junit.Assert.assertEquals;
import javax.ejb.EJB;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(Arquillian.class)
public class GreeterTest {
@Deployment
public static JavaArchive createDeployment() {
return ShrinkWrap.create(JavaArchive.class)
.addClass(Greeter.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
@Inject
Greeter greeter;
@Test
public void should_create_greeting() {
assertEquals("Hello, Earthling!", greeter.greet("Earthling"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment