@Test public void testAdd() throws Exception { ResultActions resultActions = mvc.perform(MockMvcRequestBuilders.post("/users") .param("username", "yudaoyuanma") .param("passowrd", "nicai")); resultActions.andExpect(MockMvcResultMatchers.status().isOk()); resultActions.andExpect(MockMvcResultMatchers.content().string("1")); }
@PostMapping("") public Integer add(UserAddDTO addDTO) { Integer returnId = 1; return returnId; }
UserController { @PostMapping("") public Integer add(UserAddDTO addDTO) { Integer returnId = 1; return returnId; } }
UserController { @PostMapping("") public Integer add(UserAddDTO addDTO) { Integer returnId = 1; return returnId; }  }
UserController { @PostMapping("") public Integer add(UserAddDTO addDTO) { Integer returnId = 1; return returnId; }  @GetMapping("") List<UserVO> list(); @GetMapping("/{id}") UserVO get(@PathVariable("id") Integer id); @GetMapping("/v2/{id}") UserVO get2(@PathVariable("id") Integer id); @PostMapping("") Integer add(UserAddDTO addDTO); @PutMapping("/{id}") Boolean update(@PathVariable("id") Integer id, UserUpdateDTO updateDTO); @DeleteMapping("/{id}") Boolean delete(@PathVariable("id") Integer id); }
UserController { @PostMapping("") public Integer add(UserAddDTO addDTO) { Integer returnId = 1; return returnId; }  @GetMapping("") List<UserVO> list(); @GetMapping("/{id}") UserVO get(@PathVariable("id") Integer id); @GetMapping("/v2/{id}") UserVO get2(@PathVariable("id") Integer id); @PostMapping("") Integer add(UserAddDTO addDTO); @PutMapping("/{id}") Boolean update(@PathVariable("id") Integer id, UserUpdateDTO updateDTO); @DeleteMapping("/{id}") Boolean delete(@PathVariable("id") Integer id);  }