Skip to content

Instantly share code, notes, and snippets.

/MyTest.java Secret

Created Aug 3, 2015
Embed
What would you like to do?
@RunWith(Arquillian.class)
public class MyTest {
@Deployment
public static WebArchive createDeployment() {
PomEquippedResolveStage pom = Maven.resolver().loadPomFromFile("pom.xml");
BeansDescriptor beansXml = Descriptors.create(BeansDescriptor.class).addDefaultNamespaces().getOrCreateAlternatives()
.stereotype(Mock.class.getName()).up();
return ShrinkWrap.create(WebArchive.class).addAsLibrary(pom.resolve("org.mockito:mockito-core").withTransitivity().asfile()))
.addClasses(MyComponentToTest.class, MyDependency.class).addClasses(Mocks.class, Mock.class)
.addAsWebInfResource(beansXml.exportAsString(), "beans.xml");
}
@inject
private MyDependency myDependency;
@inject
private MyComponentToTest myComponent;
@test
public void myComponentTest() {
...
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment