I have a JUnit test that starts an spring-boot application (in my case, the main class is SpringTestDemoApp
) after the test:
@WebIntegrationTest
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SpringTestDemoApp.class)
public class SpringTest {
@Test
public void test() {
// Test http://localhost:8080/ (with Selenium)
}
}
Everything works fine using spring-boot 1.3.3.RELEASE
. Nevertheless, the annotation @WebIntegrationTest
and @SpringApplicationConfiguration
have been removed in spring-boot 1.5.2.RELEASE
. I tried to refactor the code to the new version, but I am not able to do it. With the following test, my app is not started before the test and http://localhost:8080 returns 404:
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SpringTestDemoApp.class)
@WebAppConfiguration
public class SpringTest {
@Test
public void test() {
// The same test than before
}
}
How can I refactor my test to make it works in spring-boot 1.5?