ReplicaMap { ReplicaInfo add(String bpid, ReplicaInfo replicaInfo) { checkBlockPool(bpid); checkBlock(replicaInfo); try (AutoCloseableLock l = writeLock.acquire()) { FoldedTreeSet<ReplicaInfo> set = map.get(bpid); if (set == null) { set = new FoldedTreeSet<>(); map.put(bpid, set); } return set.addOrReplace(replicaInfo); } } ReplicaMap(AutoCloseableLock readLock, AutoCloseableLock writeLock);   ReplicaMap(ReadWriteLock lock);   }
@Test public void testAdd() { try { map.add(bpid, null); fail("Expected exception not thrown"); } catch (IllegalArgumentException expected) { } }