I wrote one unit test that tests UsersController. UsersControllerTest.findUser is working fine, but UsersControllerTest.insertGetModifyDelete it doesn\'t.
In the log
You can try to debug this program.i think probleam is happend in "mockMvc" object is not autowired.mockMvc object should load from WebApplicationContext in before program run.
@Autowired
private WebApplicationContext webApplicationContext
@Before()
public void setup()
{
//Init MockMvc Object and build
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
}
I got around it with @AutoConfigureMockMvc(addFilters = false)
. Please make sure that this won't compromise other functionality on your HTTP stack.