### Question:
AdminRouteController { @PostMapping(value = "/adminroute") public HttpEntity addRoute(@RequestBody RouteInfo request, @RequestHeader HttpHeaders headers) { return ok(adminRouteService.createAndModifyRoute(request, headers)); }  @GetMapping(path = "/welcome") String home(@RequestHeader HttpHeaders headers); @CrossOrigin(origins = "*") @GetMapping(path = "/adminroute") HttpEntity getAllRoutes(@RequestHeader HttpHeaders headers); @PostMapping(value = "/adminroute") HttpEntity addRoute(@RequestBody RouteInfo request, @RequestHeader HttpHeaders headers); @DeleteMapping(value = "/adminroute/{routeId}") HttpEntity deleteRoute(@PathVariable String routeId, @RequestHeader HttpHeaders headers);  }### Answer:
@Test public void testAddRoute() throws Exception { RouteInfo request = new RouteInfo(); Mockito.when(adminRouteService.createAndModifyRoute(Mockito.any(RouteInfo.class), Mockito.any(HttpHeaders.class))).thenReturn(response); String requestJson = JSONObject.toJSONString(request); String result = mockMvc.perform(MockMvcRequestBuilders.post("/api/v1/adminrouteservice/adminroute").contentType(MediaType.APPLICATION_JSON).content(requestJson)) .andExpect(MockMvcResultMatchers.status().isOk()) .andReturn().getResponse().getContentAsString(); Assert.assertEquals(response, JSONObject.parseObject(result, Response.class)); }