### Question:
ReferenceCountedACLCache { public synchronized Long convertAcls(List<ACL> acls) { if (acls == null) { return OPEN_UNSAFE_ACL_ID; } Long ret = aclKeyMap.get(acls); if (ret == null) { ret = incrementIndex(); longKeyMap.put(ret, acls); aclKeyMap.put(acls, ret); } addUsage(ret); return ret; }  synchronized Long convertAcls(List<ACL> acls); synchronized List<ACL> convertLong(Long longVal); void deserialize(InputArchive ia); void serialize(OutputArchive oa); int size(); synchronized void addUsage(Long acl); synchronized void removeUsage(Long acl); synchronized void purgeUnused();  }### Answer:
@Test public void testSameACLGivesSameID() { List<ACL> testACL = createACL("myid"); ReferenceCountedACLCache cache = new ReferenceCountedACLCache(); Long aclId = cache.convertAcls(testACL); List<ACL> testACL2 = createACL("myid"); assertEquals(aclId, cache.convertAcls(testACL2)); }
@Test public void testWhetherOrderingMatters() { List<ACL> testACL = new ArrayList<ACL>(); testACL.add(new ACL(ZooDefs.Perms.READ, new Id("scheme", "ro"))); testACL.add(new ACL(ZooDefs.Perms.WRITE, new Id("scheme", "rw"))); ReferenceCountedACLCache cache = new ReferenceCountedACLCache(); Long aclId = cache.convertAcls(testACL); List<ACL> testACL2 = new ArrayList<ACL>(); testACL2.add(new ACL(ZooDefs.Perms.WRITE, new Id("scheme", "rw"))); testACL2.add(new ACL(ZooDefs.Perms.READ, new Id("scheme", "ro"))); assertFalse(aclId.equals(cache.convertAcls(testACL2))); }