I am writing unit test for controller.
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = MyControllerWebConfig.class)
@WebAppConfiguration
public class MyControllerTest{
@Autowired
private WebApplicationContext webApplicationContext;
....
@Test
public void testSomeThing()
{
// wanna do something like below:
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext)
.addFilter(new someFilter())
.addInterceptors(new MyInterceptor())
.build();
....
}
}
I know that addInterceptors works only with statndaloneSetup(). How can we make it work with webAppContextSetup()