UserController { @RequestMapping(value = "/registration", method = RequestMethod.POST) public User register(@Validated(Create.class) @RequestBody User user) { return userService.createUser(user); } @Autowired  UserController(UserService userService);  UserController(); @RequestMapping(value = "/registration", method = RequestMethod.POST) User register(@Validated(Create.class) @RequestBody User user); @RequestMapping(value = "/login", method = RequestMethod.POST) User login(@Validated(Authenticate.class) @RequestBody User user, HttpServletResponse response); void setService(UserService service);  }
@Test public void testValidRegister(){ assertEquals(user, userController.register(user)); }
@Test public void testInvalidRegister(){ assertEquals(null, userController.register(user2)); }