### Question:
VerifyCodeController { @GetMapping(value = "/verify/{verifyCode}") public boolean verifyCode(@PathVariable String verifyCode, HttpServletRequest request, HttpServletResponse response, @RequestHeader HttpHeaders headers) { LOGGER.info("receivedCode " + verifyCode); return verifyCodeService.verifyCode(request, response, verifyCode, headers); }  @GetMapping("/generate") void imageCode(@RequestHeader HttpHeaders headers,
                          HttpServletRequest request,
                          HttpServletResponse response); @GetMapping(value = "/verify/{verifyCode}") boolean verifyCode(@PathVariable String verifyCode, HttpServletRequest request,
                              HttpServletResponse response, @RequestHeader HttpHeaders headers);  }### Answer:
@Test public void testVerifyCode() throws Exception { Mockito.when(verifyCodeService.verifyCode(Mockito.any(HttpServletRequest.class), Mockito.any(HttpServletResponse.class), Mockito.anyString(), Mockito.any(HttpHeaders.class))).thenReturn(true); String result = mockMvc.perform(MockMvcRequestBuilders.get("/api/v1/verifycode/verify/verifyCode")) .andExpect(MockMvcResultMatchers.status().isOk()) .andReturn().getResponse().getContentAsString(); Assert.assertTrue(JSONObject.parseObject(result, Boolean.class)); }