@Test public void userListTest() throws Exception { String url = "/user/list/false"; MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get(url)) .andExpect(MockMvcResultMatchers.status().isOk()) .andReturn(); MockHttpServletResponse response = mvcResult.getResponse(); System.out.println(response.getStatus()); System.out.println(response.getContentAsString()); }
@RequestMapping(value = "/user/list/{exception}") public Result<User> userList(@PathVariable("exception") Boolean exception) { if (exception) { return null; } return MessageUtil.success(userRepository.findAll()); }
UserController { @RequestMapping(value = "/user/list/{exception}") public Result<User> userList(@PathVariable("exception") Boolean exception) { if (exception) { return null; } return MessageUtil.success(userRepository.findAll()); } }
UserController { @RequestMapping(value = "/user/list/{exception}") public Result<User> userList(@PathVariable("exception") Boolean exception) { if (exception) { return null; } return MessageUtil.success(userRepository.findAll()); }  }
UserController { @RequestMapping(value = "/user/list/{exception}") public Result<User> userList(@PathVariable("exception") Boolean exception) { if (exception) { return null; } return MessageUtil.success(userRepository.findAll()); }  @PostMapping(value = "/user") User userAdd(@RequestBody User userParams); @RequestMapping(value = "/user/list/{exception}") Result<User> userList(@PathVariable("exception") Boolean exception); @RequestMapping(value = "/user/{id}") Result<User> userFindOne(@PathVariable("id") Integer id); @RequestMapping(value = "/user/name", method = RequestMethod.GET) List<User> findUserListByName(@RequestParam(name="name",defaultValue="") String name); @PutMapping(value = "/user/{id}") User userUpdate(
            @PathVariable("id") Integer id,
            @RequestParam("name") String name,
            @RequestParam("age") Integer age
    ); @DeleteMapping(value = "/user/{id}") Result deleteUser(@PathVariable("id") Integer id); }
UserController { @RequestMapping(value = "/user/list/{exception}") public Result<User> userList(@PathVariable("exception") Boolean exception) { if (exception) { return null; } return MessageUtil.success(userRepository.findAll()); }  @PostMapping(value = "/user") User userAdd(@RequestBody User userParams); @RequestMapping(value = "/user/list/{exception}") Result<User> userList(@PathVariable("exception") Boolean exception); @RequestMapping(value = "/user/{id}") Result<User> userFindOne(@PathVariable("id") Integer id); @RequestMapping(value = "/user/name", method = RequestMethod.GET) List<User> findUserListByName(@RequestParam(name="name",defaultValue="") String name); @PutMapping(value = "/user/{id}") User userUpdate(
            @PathVariable("id") Integer id,
            @RequestParam("name") String name,
            @RequestParam("age") Integer age
    ); @DeleteMapping(value = "/user/{id}") Result deleteUser(@PathVariable("id") Integer id);  }