### Question:
ConsignController { @PostMapping(value = "/consigns") public HttpEntity insertConsign(@RequestBody Consign request, @RequestHeader HttpHeaders headers) { return ok(service.insertConsignRecord(request, headers)); }  @GetMapping(path = "/welcome") String home(@RequestHeader HttpHeaders headers); @PostMapping(value = "/consigns") HttpEntity insertConsign(@RequestBody Consign request,
                                    @RequestHeader HttpHeaders headers); @PutMapping(value = "/consigns") HttpEntity updateConsign(@RequestBody Consign request, @RequestHeader HttpHeaders headers); @GetMapping(value = "/consigns/account/{id}") HttpEntity findByAccountId(@PathVariable String id, @RequestHeader HttpHeaders headers); @GetMapping(value = "/consigns/order/{id}") HttpEntity findByOrderId(@PathVariable String id, @RequestHeader HttpHeaders headers); @GetMapping(value = "/consigns/{consignee}") HttpEntity findByConsignee(@PathVariable String consignee, @RequestHeader HttpHeaders headers);  }### Answer:
@Test public void testInsertConsign() throws Exception { Consign request = new Consign(); Mockito.when(service.insertConsignRecord(Mockito.any(Consign.class), Mockito.any(HttpHeaders.class))).thenReturn(response); String requestJson = JSONObject.toJSONString(request); String result = mockMvc.perform(MockMvcRequestBuilders.post("/api/v1/consignservice/consigns").contentType(MediaType.APPLICATION_JSON).content(requestJson)) .andExpect(MockMvcResultMatchers.status().isOk()) .andReturn().getResponse().getContentAsString(); Assert.assertEquals(response, JSONObject.parseObject(result, Response.class)); }