### Question:
Host2NodesMap { boolean contains(DatanodeDescriptor node) { if (node==null) { return false; } String ipAddr = node.getIpAddr(); hostmapLock.readLock().lock(); try { DatanodeDescriptor[] nodes = map.get(ipAddr); if (nodes != null) { for(DatanodeDescriptor containedNode:nodes) { if (node==containedNode) { return true; } } } } finally { hostmapLock.readLock().unlock(); } return false; }  DatanodeDescriptor getDatanodeByXferAddr(String ipAddr,
      int xferPort); @Override String toString();  }### Answer:
@Test public void testContains() throws Exception { DatanodeDescriptor nodeNotInMap = DFSTestUtil.getDatanodeDescriptor("3.3.3.3", "/d1/r4"); for (int i = 0; i < dataNodes.length; i++) { assertTrue(map.contains(dataNodes[i])); } assertFalse(map.contains(null)); assertFalse(map.contains(nodeNotInMap)); }