### Question:
FolderServiceImpl extends RemoteServiceServlet implements FolderService { @Override public void applyRights(GUIFolder folder, boolean subtree) throws ServerException { Session session = ServiceUtil.validateSession(getThreadLocalRequest()); try { FolderDAO fdao = (FolderDAO) Context.get().getBean(FolderDAO.class); Folder f = fdao.findById(folder.getId()); fdao.initialize(f); if (subtree) { FolderHistory history = new FolderHistory(); history.setSession(session); history.setEvent(FolderEvent.PERMISSION.toString()); fdao.applyRightToTree(folder.getId(), history); } else { saveRules(session, f, session.getUserId(), folder.getRights()); } } catch (Throwable t) { ServiceUtil.throwServerException(session, log, t); } }  @Override GUIFolder inheritRights(long folderId, long rightsFolderId); @Override void applyRights(GUIFolder folder, boolean subtree); @Override void applyMetadata(long parentId); @Override void delete(final long[] folderIds); static GUIFolder fromFolder(Folder folder, boolean computePath); @Override int[] computeStats(long folderId); static GUIFolder getFolder(Session session, long folderId); static GUIFolder getFolder(Session session, long folderId, boolean computePath); @Override GUIFolder getFolder(long folderId, boolean computePath, boolean computeDocs, boolean computeSubfolders); @Override void copyFolders(long[] folderIds, long targetId, boolean foldersOnly, boolean inheritSecurity); @Override void move(long[] folderIds, long targetId); @Override void rename(long folderId, String name); @Override GUIFolder save(GUIFolder folder); @Override GUIFolder create(GUIFolder newFolder, boolean inheritSecurity); @Override GUIFolder createAlias(long parentId, long foldRef); @Override void paste(long[] docIds, long folderId, String action); @Override void pasteAsAlias(long[] docIds, long folderId, String type); @Override GUIValue[] loadTemplates(); @Override void saveTemplates(GUIValue[] templates); @Override void applyTemplate(long folderId, long templateId, boolean inheritSecurity); @Override void restore(Long[] folderIds, long parentId); @Override void deleteFromTrash(Long[] ids); @Override void applyTags(long parentId); @Override void setFolderPagination(long folderId, Integer startRecord, Integer pageSize); @Override void applyGridLayout(long folderId); @Override void applyOCR(long parentId);  }### Answer:
@Test public void testApplyRights() throws ServerException { Folder parentFolder = folderDao.findById(6); Assert.assertNotNull(parentFolder); Assert.assertTrue(folderDao.isPermissionEnabled(Permission.DELETE, 1201, 3)); Assert.assertTrue(folderDao.isPermissionEnabled(Permission.RENAME, 1201, 3)); Folder childFolder1 = folderDao.findById(1202); Assert.assertNotNull(childFolder1); Assert.assertEquals(1201, childFolder1.getParentId()); Assert.assertTrue(folderDao.isPermissionEnabled(Permission.DELETE, 1202, 3)); Assert.assertTrue(folderDao.isPermissionEnabled(Permission.RENAME, 1202, 3)); GUIFolder folder = service.getFolder(6, false, false, false); service.applyRights(folder, true); Assert.assertTrue(folderDao.isPermissionEnabled(Permission.DELETE, 1202, 1)); Assert.assertTrue(folderDao.isPermissionEnabled(Permission.RENAME, 1202, 1)); Assert.assertTrue(folderDao.isPermissionEnabled(Permission.DELETE, 1201, 1)); Assert.assertTrue(folderDao.isPermissionEnabled(Permission.RENAME, 1201, 1)); }