### Question:
ObjectAclFactory implements AclFactory { @Override public List<RoleAssignment> getStaffRoleAssignments(PID pid) { return getRoleAssignments(pid, true); } ObjectAclFactory(); void init(); @Override Map<String, Set<String>> getPrincipalRoles(PID pid); @Override List<RoleAssignment> getStaffRoleAssignments(PID pid); @Override List<RoleAssignment> getPatronRoleAssignments(PID pid); @Override List<RoleAssignment> getPatronAccess(PID pid); @Override Date getEmbargoUntil(PID pid); @Override boolean isMarkedForDeletion(PID pid); long getCacheTimeToLive(); void setCacheTimeToLive(long cacheTimeToLive); long getCacheMaxSize(); void setCacheMaxSize(long cacheMaxSize); void setRepositoryObjectCacheLoader(RepositoryObjectCacheLoader repositoryObjectCacheLoader);  }### Answer:
@Test public void testGetStaffRolesSingleRoleValid() { objResc.addLiteral(CdrAcl.canManage, MANAGE_GRP); List<RoleAssignment> assignments = aclFactory.getStaffRoleAssignments(pid); assertEquals(1, assignments.size()); RoleAssignment assignment = assignments.get(0); assertEquals(pid.getId(), assignment.getAssignedTo()); assertEquals(CdrAcl.canManage, assignment.getRole().getProperty()); assertEquals(MANAGE_GRP, assignment.getPrincipal()); }
@Test public void testGetStaffRolesMultipleSamePrincipalValid() { objResc.addLiteral(CdrAcl.canManage, MANAGE_GRP); objResc.addLiteral(CdrAcl.canAccess, MANAGE_GRP); List<RoleAssignment> assignments = aclFactory.getStaffRoleAssignments(pid); assertEquals(2, assignments.size()); RoleAssignment assignment1 = getAssignmentByRole(assignments, CdrAcl.canManage); assertEquals(pid.getId(), assignment1.getAssignedTo()); assertEquals(CdrAcl.canManage, assignment1.getRole().getProperty()); assertEquals(MANAGE_GRP, assignment1.getPrincipal()); RoleAssignment assignment2 = getAssignmentByRole(assignments, CdrAcl.canAccess); assertEquals(pid.getId(), assignment2.getAssignedTo()); assertEquals(CdrAcl.canAccess, assignment2.getRole().getProperty()); assertEquals(MANAGE_GRP, assignment2.getPrincipal()); }
@Test public void testGetStaffRolesMultipleValid() { objResc.addLiteral(CdrAcl.canManage, MANAGE_GRP); objResc.addLiteral(CdrAcl.canAccess, USER_PRINC); List<RoleAssignment> assignments = aclFactory.getStaffRoleAssignments(pid); assertEquals(2, assignments.size()); RoleAssignment assignment1 = getAssignmentByRole(assignments, CdrAcl.canManage); assertEquals(pid.getId(), assignment1.getAssignedTo()); assertEquals(CdrAcl.canManage, assignment1.getRole().getProperty()); assertEquals(MANAGE_GRP, assignment1.getPrincipal()); RoleAssignment assignment2 = getAssignmentByRole(assignments, CdrAcl.canAccess); assertEquals(pid.getId(), assignment2.getAssignedTo()); assertEquals(CdrAcl.canAccess, assignment2.getRole().getProperty()); assertEquals(USER_PRINC, assignment2.getPrincipal()); }
@Test public void testGetStaffRolesOnlyPatronAssignments() { objResc.addLiteral(CdrAcl.canViewOriginals, USER_PRINC); List<RoleAssignment> assignments = aclFactory.getStaffRoleAssignments(pid); assertTrue(assignments.isEmpty()); }
@Test public void testGetStaffRolesNoAssignments() { List<RoleAssignment> assignments = aclFactory.getStaffRoleAssignments(pid); assertTrue(assignments.isEmpty()); }