Getting first JUnit Test to Run/Pass

In the Manual Configuration chapter, Start POMs section, the out of date code does not work. I have downloaded all the recent releases, but two of the annotations have been removed and replaced.

//import org.springframework.boot.test.SpringApplicationConfiguration;
//@SpringApplicationConfiguration(Application.class)

import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest(classes = Application.class)

//import org.springframework.boot.test.WebIntegrationTest;
//@WebIntegrationTest()

import org.springframework.test.context.web.WebAppConfiguration;
@WebAppConfiguration

public class ApplicationTest { ...

Right-click on ApplicationTest.java > Run as JUnit test now works 🙂

Leave a comment