CodeController { @RequestMapping(value = "/generate", method = RequestMethod.POST) public ServiceResult generateProject(@RequestBody GenerateCodeModel generateCodeRequest, HttpServletRequest request) { return codeService.generateProject(generateCodeRequest, request); }  @RequestMapping(value = "/count") ServiceResult countProject(@RequestParam(value = "projectId", defaultValue = "0") Long projectId); @RequestMapping(value = "/generate", method = RequestMethod.POST) ServiceResult generateProject(@RequestBody GenerateCodeModel generateCodeRequest, HttpServletRequest request); @RequestMapping(value = "/files") ServiceResult<List<W2uiElement>> getFiles(@RequestParam(value = "projectId", defaultValue = "") String projectId,
                                                     @RequestParam(value = "name", defaultValue = "") String name); @RequestMapping(value = "/content") ServiceResult<String> getFileContent(@RequestParam(value = "projectId", defaultValue = "") String projectId,
                                                @RequestParam(value = "name", defaultValue = "") String name); @RequestMapping("/download") String download(@RequestParam(value = "projectId") Long projectId, HttpServletResponse response); @RequestMapping(value = "/clearFiles") ServiceResult clearFiles(@RequestParam(value = "projectId") Integer projectId);  }
@Test public void generateProject() throws Exception { String requestJson = JSONObject.toJSONString(GenerateCodeModel.builder().projectId(1L).build()); mockMvc.perform(MockMvcRequestBuilders.get("/code/generate") .contentType(MediaType.APPLICATION_JSON_UTF8) .content(requestJson) .accept(MediaType.APPLICATION_JSON_UTF8)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()); }