Spring testowania asyncResult () i jsonPath () razem

Używam uspokajającego adresu URL, aby rozpocząć długotrwały proces backendu (zwykle jest to harmonogram cron, ale chcemy, aby można go było ręcznie uruchomić).

Poniższy kod działa i widzę wynik w przeglądarce, gdy testuję ręcznie.

@ResponseBody
@RequestMapping(value = "/trigger/{jobName}", method = RequestMethod.GET)
public Callable<TriggerResult> triggerJob(@PathVariable final String jobName) {

    return new Callable<TriggerResult>() {
        @Override
        public TriggerResult call() throws Exception {
            // Code goes here to locate relevant job and kick it off, waiting for result
            String message = <result from my job>;
            return new TriggerResult(SUCCESS, message);
        }
    };
}

Kiedy testuję to bezCallable Użyłem poniższego kodu i wszystko działa (zmieniłem oczekiwany komunikat o błędzie w celu uproszczenia postu).

mockMvc.perform(get("/trigger/job/xyz"))
    .andExpect(status().isOk())
    .andDo(print())
    .andExpect(jsonPath("status").value("SUCCESS"))
    .andExpect(jsonPath("message").value("A meaningful message appears"));

Kiedy dodałemCallable jednak to nie działa. Próbowałem również poniżej, ale to nie działa. Czy ktoś inny odniósł sukces?

mockMvc.perform(get("/trigger/job/xyz"))
    .andExpect(status().isOk())
    .andDo(print())
    .andExpect(request().asyncResult(jsonPath("status").value("SUCCESS")))
    .andExpect(request().asyncResult(jsonPath("message").value("A meaningful message appears")));

Poniżej znajduje się odpowiednia część mojego druku (). Wygląda na to, że mockMvc nie może poprawnie rozplątać Jsona w tym przypadku (nawet jeśli działa w mojej przeglądarce)? Kiedy to robię bezCallable Widzę pełny JSON.

MockHttpServletRequest:
     HTTP Method = GET
     Request URI = /trigger/job/xyz
      Parameters = {}
         Headers = {}

         Handler:
            Type = foo.bar.web.controller.TriggerJobController
          Method = public java.util.concurrent.Callable<foo.bar.myproject.web.model.TriggerResult> foo.bar.myproject.web.controller.TriggerJobController.triggerJob(java.lang.String)

           Async:
 Was async started = true
      Async result = foo.bar.myproject.web.model.TriggerResult@67aa1e71


Resolved Exception:
            Type = null

    ModelAndView:
       View name = null
            View = null
           Model = null

        FlashMap:

MockHttpServletResponse:
          Status = 200
   Error message = null
         Headers = {}
    Content type = null
            Body = 
   Forwarded URL = null
  Redirected URL = null
         Cookies = []

questionAnswers(3)

yourAnswerToTheQuestion