### Question:
BlockInfo extends Block implements LightWeightGSet.LinkedElement { DatanodeStorageInfo getStorageInfo(int index) { assert this.triplets != null : "BlockInfo is not initialized"; assert index >= 0 && index*3 < triplets.length : "Index is out of bound"; return (DatanodeStorageInfo)triplets[index*3]; } BlockInfo(int replication);  BlockInfo(Block blk, int replication); protected  BlockInfo(BlockInfo from); BlockCollection getBlockCollection(); void setBlockCollection(BlockCollection bc); DatanodeDescriptor getDatanode(int index); int getCapacity(); int numNodes(); BlockInfo moveBlockToHead(BlockInfo head, DatanodeStorageInfo storage,
      int curIndex, int headIndex); BlockUCState getBlockUCState(); boolean isComplete(); BlockInfoUnderConstruction convertToBlockUnderConstruction(
      BlockUCState s, DatanodeStorageInfo[] targets); @Override int hashCode(); @Override boolean equals(Object obj); @Override LightWeightGSet.LinkedElement getNext(); @Override void setNext(LightWeightGSet.LinkedElement next); static final BlockInfo[] EMPTY_ARRAY; }### Answer:
@Test public void testReplaceStorage() throws Exception { final DatanodeStorageInfo storage1 = DFSTestUtil.createDatanodeStorageInfo("storageID1", "127.0.0.1"); final DatanodeStorageInfo storage2 = new DatanodeStorageInfo(storage1.getDatanodeDescriptor(), new DatanodeStorage("storageID2")); final int NUM_BLOCKS = 10; BlockInfo[] blockInfos = new BlockInfo[NUM_BLOCKS]; for (int i = 0; i < NUM_BLOCKS; ++i) { blockInfos[i] = new BlockInfo(3); storage1.addBlock(blockInfos[i]); } boolean added = storage2.addBlock(blockInfos[NUM_BLOCKS/2]); Assert.assertThat(added, is(false)); Assert.assertThat(blockInfos[NUM_BLOCKS/2].getStorageInfo(0), is(storage2)); }