### Question:
IMSController { @RequestMapping(value = "/api/inventory/count", method = RequestMethod.POST) @ResponseBody public ResponseEntity getInventory(@RequestBody IMSRequestQuery payload) { InventoryResult result; try { result = inventoryEstimateService.aggregateInventory(payload.getTargetingChannel(), payload.getDays(), payload.getPrice()); String logMessage = String.format("Targeting channel: %s estimate: %d", payload.getTargetingChannel().getQueryKey(), result.getAvailCount()); LOGGER.info(logMessage); } 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 getInventory() throws Exception { IMSRequestQuery payload = new IMSRequestQuery(); TargetingChannel tc = new TargetingChannel(); tc.setG(Arrays.asList("g_f")); tc.setA(Arrays.asList("3")); payload.setTargetingChannel(tc); List<Range> ranges = new ArrayList<>(); Range r1 = new Range(); r1.setSt("2018-01-05"); r1.setEd("2018-01-05"); r1.setSh("0"); r1.setEh("23"); ranges.add(r1); payload.setDays(ranges); payload.setPrice(100D); when(invEstSrv.aggregateInventory(payload.getTargetingChannel(), payload.getDays(), payload.getPrice())) .thenReturn(new InventoryResult()); String reqJson = "{\"targetingChannel\": {\"g\":[\"g_f\"],\"a\":[\"3\"]},\"price\":100,\"days\": [{\"st\": \"2018-01-05\",\"ed\": \"2018-01-05\",\"sh\": 0,\"eh\": 23}]}"; MvcResult res = (MvcResult) mockMvc.perform(post("/api/inventory/count").contentType( MediaType.APPLICATION_JSON).content(reqJson)) .andReturn(); System.out.println("getInventory " + res.toString()); }