Source:
<code>public void testNewSecurityPolicy() throws Exception { DocumentRef folderRef; try (CoreSession session = coreFeature.openCoreSession(ADMINISTRATOR)) { setTestPermissions(ANONYMOUS, READ); DocumentModel root = session.getRootDocument(); DocumentModel folder = new DocumentModelImpl(root.getPathAsString(), "folder#1", "Folder"); folder.setProperty("secupolicy", "securityLevel", Long.valueOf(4)); folder = session.createDocument(folder); folderRef = folder.getRef(); session.save(); Principal fooUser = new UserPrincipal("foo", new ArrayList<String>(), false, false); assertFalse(session.hasPermission(fooUser, folderRef, READ)); <START> assertArrayEquals(session.filterGrantedPermissions(fooUser, folderRef, Arrays.asList(READ)).toArray(), new String[0]); <END> setTestPermissions(fooUser.getName(), READ); assertTrue(session.hasPermission(fooUser, folderRef, READ)); assertArrayEquals(session.filterGrantedPermissions(fooUser, folderRef, Arrays.asList(READ)).toArray(), new String[] { READ }); } try (CoreSession session = coreFeature.openCoreSession(ANONYMOUS)) { DocumentModelImpl documentModelImpl = new DocumentModelImpl("User"); Map<String, Object> data = new HashMap<String, Object>(); data.put("accessLevel", Long.valueOf(3)); documentModelImpl.addDataModel(new DataModelImpl("user", data)); ((NuxeoPrincipal) session.getPrincipal()).setModel(documentModelImpl); assertFalse(session.hasPermission(folderRef, READ)); ((NuxeoPrincipal) session.getPrincipal()).getModel().setProperty("user", "accessLevel", Long.valueOf(5)); assertTrue(session.hasPermission(folderRef, READ)); session.save(); } }</code><technical_language>compare lists directly, need arrays now</technical_language>

Target:
public void testNewSecurityPolicy() throws Exception { DocumentRef folderRef; try (CoreSession session = coreFeature.openCoreSession(ADMINISTRATOR)) { setTestPermissions(ANONYMOUS, READ); DocumentModel root = session.getRootDocument(); DocumentModel folder = new DocumentModelImpl(root.getPathAsString(), "folder#1", "Folder"); folder.setProperty("secupolicy", "securityLevel", Long.valueOf(4)); folder = session.createDocument(folder); folderRef = folder.getRef(); session.save(); Principal fooUser = new UserPrincipal("foo", new ArrayList<String>(), false, false); assertFalse(session.hasPermission(fooUser, folderRef, READ)); assertTrue(session.filterGrantedPermissions(fooUser, folderRef, Arrays.asList(READ)).isEmpty()); setTestPermissions(fooUser.getName(), READ); assertTrue(session.hasPermission(fooUser, folderRef, READ)); assertEquals(session.filterGrantedPermissions(fooUser, folderRef, Arrays.asList(READ)), Arrays.asList(READ)); } try (CoreSession session = coreFeature.openCoreSession(ANONYMOUS)) { DocumentModelImpl documentModelImpl = new DocumentModelImpl("User"); Map<String, Object> data = new HashMap<String, Object>(); data.put("accessLevel", Long.valueOf(3)); documentModelImpl.addDataModel(new DataModelImpl("user", data)); ((NuxeoPrincipal) session.getPrincipal()).setModel(documentModelImpl); assertFalse(session.hasPermission(folderRef, READ)); ((NuxeoPrincipal) session.getPrincipal()).getModel().setProperty("user", "accessLevel", Long.valueOf(5)); assertTrue(session.hasPermission(folderRef, READ)); session.save(); } }