### Question:
ReplicasMap { ReplicaInfo remove(String bpid, Block block) { checkBlockPool(bpid); checkBlock(block); synchronized(mutex) { Map<Long, ReplicaInfo> m = map.get(bpid); if (m != null) { Long key = Long.valueOf(block.getBlockId()); ReplicaInfo replicaInfo = m.get(key); if (replicaInfo != null && block.getGenerationStamp() == replicaInfo.getGenerationStamp()) { return m.remove(key); } } } return null; } ReplicasMap(Object mutex);   }### Answer:
@Test public void testRemove() { try { map.remove(bpid, null); fail("Expected exception not thrown"); } catch (IllegalArgumentException expected) { } Block b = new Block(block); b.setGenerationStamp(0); assertNull(map.remove(bpid, b)); b.setGenerationStamp(block.getGenerationStamp()); b.setBlockId(0); assertNull(map.remove(bpid, b)); assertNotNull(map.remove(bpid, block)); assertNull(map.remove(bpid, 0)); map.add(bpid, new FinalizedReplica(block, null, null)); assertNotNull(map.remove(bpid, block.getBlockId())); }