### Question:
SecurityServiceImpl extends RemoteServiceServlet implements SecurityService { @Override public void addUserToGroup(long groupId, long userId) throws ServerException { ServiceUtil.checkMenu(getThreadLocalRequest(), Menu.SECURITY); Session session = ServiceUtil.checkMenu(getThreadLocalRequest(), Menu.SECURITY); UserDAO userDao = (UserDAO) Context.get().getBean(UserDAO.class); GroupDAO groupDao = (GroupDAO) Context.get().getBean(GroupDAO.class); User user = userDao.findById(userId, true); user.addGroup(groupDao.findById(groupId)); try { userDao.store(user); userDao.initialize(user); } catch (Throwable t) { ServiceUtil.throwServerException(session, log, t); } }  static GUITenant getTenant(long tenantId); static GUITenant fromTenant(Tenant tenant); static GUITenant getTenant(String tenantName); GUISession loadSession(Session sess, String locale); @Override GUISession getSession(String locale); @Override void logout(); @Override int changePassword(Long requestorUserId, long userId, String oldPassword, String newPassword,
			boolean notify); @Override void addUserToGroup(long groupId, long userId); @Override void deleteGroup(long groupId); @Override void deleteUser(long userId); @Override GUIGroup getGroup(long groupId); @Override GUIUser getUser(long userId); @Override void removeFromGroup(long groupId, long[] userIds); @Override GUIGroup saveGroup(GUIGroup group); @Override GUIUser saveUser(GUIUser user, GUIInfo info); @Override GUIUser saveProfile(GUIUser user); @Override GUIUser saveInterfaceSettings(GUIUser user); @Override void kill(String sid); @Override GUISecuritySettings loadSettings(); @Override boolean saveSettings(GUISecuritySettings settings); @Override void applyRights(GUIMenu menu); @Override GUIMenu getMenu(long menuId); @Override GUIUser[] searchUsers(String username, String groupId); @Override GUISequence[] loadBlockedEntities(); @Override void removeBlockedEntities(long[] ids); @Override void replicateUsersSettings(long masterUserId, Long[] userIds, boolean gui, boolean groups);  }### Answer:
@Test public void testAddUserToGroup() throws ServerException { User test = userDAO.findByUsername("test"); Assert.assertNotNull(test); Group group = groupDAO.findByName("author", Tenant.DEFAULT_ID); Assert.assertNotNull(group); service.addUserToGroup(group.getId(), test.getId()); User user = userDAO.findByUsername("test"); Assert.assertTrue(user.getGroups().contains(group)); group = groupDAO.findByName("guest", Tenant.DEFAULT_ID); Assert.assertNotNull(group); service.addUserToGroup(group.getId(), test.getId()); user = userDAO.findByUsername("test"); Assert.assertTrue(user.getGroups().contains(group)); }