### Question:
RebookController { @PostMapping(value = "/rebook") public HttpEntity rebook(@RequestBody RebookInfo info, @RequestHeader HttpHeaders headers) { RebookController.LOGGER.info("[Rebook Service] OrderId: {} Old Trip Id: {} New Trip Id: {} Date: {} Seat Type: {}", info.getOrderId(), info.getOldTripId(), info.getTripId(), info.getDate(), info.getSeatType()); return ok(service.rebook(info, headers)); }  @GetMapping(path = "/welcome") String home(); @PostMapping(value = "/rebook/difference") HttpEntity payDifference(@RequestBody RebookInfo info,
                                    @RequestHeader HttpHeaders headers); @PostMapping(value = "/rebook") HttpEntity rebook(@RequestBody RebookInfo info, @RequestHeader HttpHeaders headers);  }### Answer:
@Test public void testRebook() throws Exception { RebookInfo info = new RebookInfo(); Mockito.when(service.rebook(Mockito.any(RebookInfo.class), Mockito.any(HttpHeaders.class))).thenReturn(response); String requestJson = JSONObject.toJSONString(info); String result = mockMvc.perform(MockMvcRequestBuilders.post("/api/v1/rebookservice/rebook").contentType(MediaType.APPLICATION_JSON).content(requestJson)) .andExpect(MockMvcResultMatchers.status().isOk()) .andReturn().getResponse().getContentAsString(); Assert.assertEquals(response, JSONObject.parseObject(result, Response.class)); }