Skip to content

Instantly share code, notes, and snippets.

@stephan-mueller
Created September 28, 2015 16:49
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 stephan-mueller/d8b4c23cdbfab187ce0e to your computer and use it in GitHub Desktop.
Save stephan-mueller/d8b4c23cdbfab187ce0e to your computer and use it in GitHub Desktop.
Arquillian test for the cdi service specializes {@link SpecializedMailService}.
@RunWith(Arquillian.class)
public class SpecializedMailServiceIT {
private static final Logger LOG = LoggerFactory.getLogger(SpecializedMailServiceIT.class);
@Deployment
public static Archive createDeployment() {
PomEquippedResolveStage pomFile = Maven.resolver().loadPomFromFile("pom.xml");
WebArchive archive = ShrinkWrap.create(WebArchive.class)
.addAsLibraries(pomFile.resolve("org.assertj:assertj-core").withTransitivity().asFile())
.addClasses(MailService.class, SpecializedMailService.class)
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
LOG.debug(archive.toString(true));
return archive;
}
@Inject
private MailService service;
@Test
public void sendMail() throws Exception {
SpecializedMailService.latch = new CountDownLatch(1);
service.sendMail("Testmail", "Das ist ein Test", "max.mustermann@openknowledge.de");
assertThat(SpecializedMailService.latch.await(2, TimeUnit.SECONDS)).isTrue();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment