### Question:
HelloSpringBoot { @PostMapping("form") public Messages form(SysUser sysUser){ Messages messages = new Messages(); if(sysUser.getUsername() !=null && sysUser.getPassword() !=null && sysUser.getUsername().equals("user") && sysUser.getPassword().equals("springboot")){ messages.setStatus("success"); messages.setMessages("Login Success"); }else { messages.setStatus("error"); messages.setMessages("Login Error"); } return messages; }  @RequestMapping("string") @ResponseStatus(HttpStatus.OK) String helloString(); @RequestMapping(value = "json") Messages helloJson(); @GetMapping(value = "param") Messages param(@RequestParam(value ="username",defaultValue = "Boot") String username); @PostMapping(value = "path/{username}") Messages pathVariable(@PathVariable("username") String username); @PostMapping("body") Messages body(@RequestBody SysUser sysUser); @PostMapping("text") String text(@RequestBody String  text); @PostMapping("form") Messages form(SysUser sysUser);  }### Answer:
@Test void testForm() throws Exception { this.mvc.perform(post("/hello/form") .contentType("application/x-www-form-urlencoded") .param("username", "user") .param("password", "springboot")) .andExpect(status().isOk()) .andExpect(content().json("{'status':'success';'messages':'Login Success'}")); }