CodeController { @RequestMapping(value = "/content") public ServiceResult<String> getFileContent(@RequestParam(value = "projectId", defaultValue = "") String projectId, @RequestParam(value = "name", defaultValue = "") String name) throws Exception { return codeService.getFileContent(projectId, name); }  @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 getFileContent() throws Exception { mockMvc.perform(MockMvcRequestBuilders.get("/code/content") .contentType(MediaType.APPLICATION_JSON_UTF8) .param("projectId", "1") .param("name", "tom") .accept(MediaType.APPLICATION_JSON_UTF8)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()); }