I\'m using a restful url to kick off a long-running backend process (it is normally on a cron schedule, but we want the ability to kick it off manually).
The code below
I think you want to use asyncDispatch on the result of the started Async calls Reference code from link below
http://static.springsource.org/spring/docs/3.2.x/javadoc-api/org/springframework/test/web/servlet/request/MockMvcRequestBuilders.html
Usage involves performing one request first that starts async processing:
MvcResult mvcResult = this.mockMvc.perform(get("/trigger/job/xyz"))
.andExpect(request().asyncStarted())
.andReturn();
And then performing the async dispatch re-using the MvcResult:
this.mockMvc.perform(asyncDispatch(mvcResult))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(content().string(.......));
or in your case
this.mockMvc.perform(asyncDispatch(mvcResult))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("status").value("SUCCESS"))
.andExpect(jsonPath("message").value("A meaningful message appears"));