### Question:
SoapFolderService extends AbstractService implements FolderService { @Override public void grantGroup(String sid, long folderId, long groupId, int permissions, boolean recursive) throws Exception { User sessionUser = validateSession(sid); FolderDAO folderDao = (FolderDAO) Context.get().getBean(FolderDAO.class); if (!folderDao.isPermissionEnabled(Permission.SECURITY, folderId, sessionUser.getId())) throw new Exception(String.format("Security Rights not granted to the user on folder id %s", folderId)); try { Folder folder = folderDao.findById(folderId); folderDao.initialize(folder); folder.setSecurityRef(null); FolderGroup fg = new FolderGroup(); fg.setGroupId(groupId); fg.setPermissions(permissions); folder.addFolderGroup(fg); FolderHistory history = new FolderHistory(); history.setEvent(FolderEvent.PERMISSION.toString()); history.setSession(SessionManager.get().get(sid)); folderDao.store(folder, history); if (recursive) { folderDao.initialize(folder); FolderHistory transaction = new FolderHistory(); transaction.setUser(sessionUser); transaction.setSessionId(sid); folderDao.applyRightToTree(folder.getId(), transaction); } } catch (Throwable e) { log.error("Some errors occurred", e); throw new Exception("error", e); } }  @Override WSFolder create(String sid, WSFolder folder); @Override WSFolder createAlias(String sid, long parentId, long foldRef); @Override long createFolder(String sid, long parentId, String name); @Override void delete(String sid, long folderId); @Override WSFolder getFolder(String sid, long folderId); @Override WSFolder findByPath(String sid, String path); @Override boolean isReadable(String sid, long folderId); @Override WSFolder[] listChildren(String sid, long folderId); @Override void move(String sid, long folderId, long parentId); @Override void copy(String sid, long folderId, long targetId, int foldersOnly, int inheritSecurity); @Override void rename(String sid, long folderId, String name); @Override WSFolder getRootFolder(String sid); @Override WSFolder getDefaultWorkspace(String sid); @Override boolean isWritable(String sid, long folderId); @Override boolean isGranted(String sid, long folderId, int permission); @Override WSFolder[] getPath(String sid, long folderId); @Override void grantUser(String sid, long folderId, long userId, int permissions, boolean recursive); @Override void grantGroup(String sid, long folderId, long groupId, int permissions, boolean recursive); @Override WSRight[] getGrantedUsers(String sid, long folderId); @Override WSRight[] getGrantedGroups(String sid, long folderId); @Override void update(String sid, WSFolder folder); @Override WSFolder createPath(String sid, long parentId, String path); @Override WSFolder[] listWorkspaces(String sid);  }### Answer:
@Test public void testGrantGroup() throws Exception { Group group = groupDao.findById(3); Assert.assertNotNull(group); Folder folder = folderDao.findById(99); Assert.assertNotNull(folder); Folder folder2 = folderDao.findById(80); Assert.assertNotNull(folder2); folderDao.initialize(folder); FolderGroup mg = folder.getFolderGroup(3); Assert.assertNull(mg); folderDao.initialize(folder2); FolderGroup mg2 = folder2.getFolderGroup(3); Assert.assertNotNull(mg2); folderServiceImpl.grantGroup("", 99, 3, 4095, false); }