So i have a multi maven module project, with a module for controllers and a module that contains the spring boot start up application class.
myApp - deployment (module) - controllers (module)
In the controllers module i want to be able to test them using mockMvc
however when i run it i get the following error:
java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test
what i want to do is still be able to test this, can i create an test application and use that?
@RunWith(SpringRunner.class)
@WebMvcTest(Controller.class)
@ActiveProfiles(Constants.TEST)
public class ControllerTest {
@Autowired
private MockMvc mockMvc;
@Test
public void contextLoads() {
assertNotNull(mockMvc);
}
}