I am using Play Framework 2.3 and IntelliJ IDEA 14. I use a Mailer plugin in my application. I wrote a few functional tests that work perfectly when I run the test
command in the SBT console, after adding this line to build.sbt:
javaOptions in Test += "-Dconfig.file=conf/application.test.conf"
And this one to the file conf/application.test.conf:
smtp.mock=yes
Unfortunately, when I run tests directly from IntelliJ, I get this error:
java.lang.RuntimeException: smtp.host needs to be set in application.conf in order to use this plugin (or set smtp.mock to true)
I tried launching those tests with the VM argument -Dconfig.file=conf/application.test.conf
, without success.
Here are two examples of the tests I am trying to execute:
@Test
public void testWithServer() {
running(testServer(3333), () -> {
assertThat(WS.url("http://localhost:3333").get().get(1000).getStatus()).isEqualTo(OK);
});
}
@Test
public void testWithBrowser() {
running(testServer(3333), HTMLUNIT, browser -> {
browser.goTo("http://localhost:3333");
assertThat(browser.$("title").getText()).isEqualTo("Welcome");
});
}
Can anyone help me on this?
Thanks!