//Mockito请参考 http://stamen.iteye.com/blog/1470066
UserService userService = Mockito.mock(UserService.class);
User user = new User();
user.setId(1L);
user.setName("zhang");
Mockito.when(userService.findById(Mockito.any(Long.class))).thenReturn(user);
return userService;
// return new UserServiceImpl(); //此处也可以返回真实的UserService实现
}
}