### Question:
IMSController { @RequestMapping(value = "/api/chart", method = RequestMethod.POST) @ResponseBody public ResponseEntity chart(@RequestBody IMSRequestQuery payload) throws JSONException { DayImpression result; try { result = inventoryEstimateService.getInventoryDateEstimate(payload.getTargetingChannel()); } catch (Exception e) { LOGGER.error(e.getMessage()); return ResponseBuilder.buildError(e); } return ResponseBuilder.build(result, HTTP_OK_CODE); }  @RequestMapping(value = "/ping", method = RequestMethod.GET) @ResponseBody ResponseEntity ping(); @RequestMapping(value = "/api/inventory/count", method = RequestMethod.POST) @ResponseBody ResponseEntity getInventory(@RequestBody IMSRequestQuery payload); @RequestMapping(value = "/api/users/count", method = RequestMethod.POST) @ResponseBody ResponseEntity getUserEstimate(@RequestBody IMSRequestQuery payload); @RequestMapping(value = "/api/bookings", method = RequestMethod.POST) @ResponseBody ResponseEntity book(@RequestBody IMSBookingRequest payload); @RequestMapping(value = "/api/bookings/{bookingId}", method = RequestMethod.DELETE) @ResponseBody ResponseEntity removeBooking(@PathVariable("bookingId") String bookingId); @RequestMapping(value = "/api/{advId}/bookings", method = RequestMethod.GET) @ResponseBody ResponseEntity getAdvID(@PathVariable("advId") String advId); @RequestMapping(value = "/api/bookings/{bookingId}", method = RequestMethod.GET) @ResponseBody ResponseEntity getBookingById(@PathVariable("bookingId") String bookingId); @RequestMapping(value = "/api/chart", method = RequestMethod.POST) @ResponseBody ResponseEntity chart(@RequestBody IMSRequestQuery payload);  }### Answer:
@Test public void chart() throws Exception { IMSRequestQuery payload = new IMSRequestQuery(); TargetingChannel tc = new TargetingChannel(); tc.setG(Arrays.asList("g_f")); tc.setA(Arrays.asList("3")); payload.setTargetingChannel(tc); when(invEstSrv.getInventoryDateEstimate(payload.getTargetingChannel())) .thenReturn(new DayImpression()); String reqJson = "{\"targetingChannel\": {\"g\":[\"g_f\"],\"a\":[\"3\"]},\"price\":100}"; MvcResult res = (MvcResult) mockMvc.perform(post("/api/chart").contentType( MediaType.APPLICATION_JSON).content(reqJson)) .andReturn(); System.out.println("chart " + res.toString()); }