### Question:
BlockInfo extends Block implements LightWeightGSet.LinkedElement { boolean addStorage(DatanodeStorageInfo storage) { int lastNode = ensureCapacity(1); setStorageInfo(lastNode, storage); setNext(lastNode, null); setPrevious(lastNode, null); return true; } 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 testAddStorage() throws Exception { BlockInfo blockInfo = new BlockInfo(3); final DatanodeStorageInfo storage = DFSTestUtil.createDatanodeStorageInfo("storageID", "127.0.0.1"); boolean added = blockInfo.addStorage(storage); Assert.assertTrue(added); Assert.assertEquals(storage, blockInfo.getStorageInfo(0)); }