### Question:
LocalFolderAndResourceAclService implements AclService { @Override public Acl readAclById(ObjectIdentity object) throws NotFoundException { InternalURI targetUri = getInternalUriFor(object); if (repositoryService.isLocalFolder(null, targetUri.getPath())) { InternalURI masterResourceUri = getMasterResourceUriFor(targetUri); Acl masterResourceAcl = aclLookupStrategy.readAclById(masterResourceUri); return new JasperServerAclImpl(targetUri, new ArrayList<>(), masterResourceAcl); } else if (isLocalResource(targetUri)) { Acl parentLocalFolderAcl = aclLookupStrategy.readAclById(new InternalURIDefinition(targetUri.getParentPath(), targetUri.getProtocol())); return new JasperServerAclImpl(targetUri, new ArrayList<>(), parentLocalFolderAcl); } return null; }  @Override List<ObjectIdentity> findChildren(ObjectIdentity parentIdentity); @Override Acl readAclById(ObjectIdentity object); @Override Acl readAclById(ObjectIdentity object, List<Sid> sids); @Override Map<ObjectIdentity, Acl> readAclsById(List<ObjectIdentity> objects); @Override Map<ObjectIdentity, Acl> readAclsById(List<ObjectIdentity> objects, List<Sid> sids); void setRepositoryService(RepositoryService repositoryService); void setAclLookupStrategy(AclService aclLookupStrategy);  }### Answer:
@Test public void readAclById_objectIdentityNotLocalResourceOrFolder_returnNull() { InternalURI objectIdentity = new InternalURIDefinition("repo:/folder1/notLocal"); when(repositoryService.isLocalFolder(null, objectIdentity.getPath())).thenReturn(false); when(repositoryService.isLocalFolder(null, objectIdentity.getParentPath())).thenReturn(false); Acl result = localHiddenFolderAclService.readAclById(objectIdentity); assertNull(result); }
@Test public void readAclById_objectIdentityIsLocalFolder_returnAcl() { String masterResourceUri = "repo:/folder1/Report1"; Acl masterResourceAcl = mockAclFor(masterResourceUri); InternalURI localFolder = createLocalFolderURI(masterResourceUri); Acl result = localHiddenFolderAclService.readAclById(localFolder); checkAcl(result, localFolder, new ArrayList<>(), masterResourceAcl); }
@Test public void readAclById_objectIdentityIsLocalResource_returnAcl() { String masterResourceUri = "repo:/folder1/Report1"; InternalURI localResource = createLocalResourceURI(masterResourceUri); Acl parentLocalFolderAcl = mockAclFor(localResource.getParentURI()); Acl result = localHiddenFolderAclService.readAclById(localResource); checkAcl(result, localResource, new ArrayList<>(), parentLocalFolderAcl); }
@Test public void readAclById_withSids_returnAcl() { List<Sid> sids = Arrays.asList(mock(Sid.class), mock(Sid.class)); InternalURI objectIdentity = new InternalURIDefinition("repo:/f1/Resource"); Acl mockAcl = mock(Acl.class); when(aclLookupStrategy.readAclById(objectIdentity)).thenReturn(mockAcl); Acl result = localHiddenFolderAclService.readAclById(objectIdentity, sids); assertSame(mockAcl, result); }