ForumService { public void addBoardManager(int boardId,String userName){ User user = userDao.getUserByUserName(userName); if(user == null){ throw new RuntimeException("用户名为"+userName+"的用户不存在。"); }else{ Board board = boardDao.get(boardId); user.getManBoards().add(board); userDao.update(user); } }  @Autowired void setTopicDao(TopicDao topicDao); @Autowired void setUserDao(UserDao userDao); @Autowired void setBoardDao(BoardDao boardDao); @Autowired void setPostDao(PostDao postDao); void addTopic(Topic topic); void removeTopic(int topicId); void addPost(Post post); void removePost(int postId); void addBoard(Board board); void removeBoard(int boardId); void makeDigestTopic(int topicId); List<Board> getAllBoards(); Page getPagedTopics(int boardId,int pageNo,int pageSize); Page getPagedPosts(int topicId,int pageNo,int pageSize); Page queryTopicByTitle(String title,int pageNo,int pageSize); Board getBoardById(int boardId); Topic getTopicByTopicId(int topicId); Post getPostByPostId(int postId); void addBoardManager(int boardId,String userName); void updateTopic(Topic topic); void updatePost(Post post);  }
@Test @DataSet("XiaoChun.DataSet.xls") public void addBoardManager(){ forumService.addBoardManager(1,"tom"); User userDb = userService.getUserByUserName("tom"); assertEquals(userDb.getManBoards().size()>0, true); }