Skip to content

Instantly share code, notes, and snippets.

@stephan-mueller
Created September 28, 2015 16:48
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/7ca320fd85396cbcd4bb to your computer and use it in GitHub Desktop.
Save stephan-mueller/7ca320fd85396cbcd4bb to your computer and use it in GitHub Desktop.
Arquillian test for the cdi service alternative {@link AlternativeMailService}.
@RunWith(Arquillian.class)
public class AlternativeMailServiceIT {
private static final Logger LOG = LoggerFactory.getLogger(AlternativeMailServiceIT.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, AlternativeMailService.class)
.addAsWebInfResource("test-beans.xml", "beans.xml");;
LOG.debug(archive.toString(true));
return archive;
}
@Inject
private MailService service;
@Test
public void sendMail() throws Exception {
AlternativeMailService.latch = new CountDownLatch(1);
service.sendMail("Testmail", "Das ist ein Test", "max.mustermann@openknowledge.de");
assertThat(AlternativeMailService.latch.await(2, TimeUnit.SECONDS)).isTrue();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment