Skip to content

Instantly share code, notes, and snippets.

@mojavelinux
Created May 8, 2012 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mojavelinux/2640101 to your computer and use it in GitHub Desktop.
Save mojavelinux/2640101 to your computer and use it in GitHub Desktop.
Arquillian test with deployment defined on static field
@RunWith(Arquillian.class)
public class AGreeterTest {
@Deployment
public static JavaArchive archive = ShrinkWrap.create(JavaArchive.class)
.addClasses(Greeter.class, PhraseBuilder.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
@Inject
Greeter greeter;
@Test
public void should_create_greeting() {
Assert.assertEquals("Hello, Earthling!", greeter.createGreeting("Earthling"));
greeter.greet(System.out, "Earthling");
}
}
@RunWith(Arquillian.class)
public class BGreeterTest {
@Deployment
public static JavaArchive archive;
static {
archive = ShrinkWrap.create(JavaArchive.class)
.addClasses(Greeter.class, PhraseBuilder.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
@Inject
Greeter greeter;
@Test
public void should_create_greeting() {
Assert.assertEquals("Hello, Earthling!", greeter.createGreeting("Earthling"));
greeter.greet(System.out, "Earthling");
}
}
@RunWith(Arquillian.class)
public class CGreeterTest {
@Deployment
public static JavaArchive archive = Deployments.createGreeterDeployment();
@Inject
Greeter greeter;
@Test
public void should_create_greeting() {
Assert.assertEquals("Hello, Earthling!", greeter.createGreeting("Earthling"));
greeter.greet(System.out, "Earthling");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment