public Node chooseRandomWithStorageType(final String scope,
      final Collection<Node> excludedNodes, StorageType type) {
    netlock.readLock().lock();
    try {
      if (scope.startsWith("~")) {
        return chooseRandomWithStorageType(
            NodeBase.ROOT, scope.substring(1), excludedNodes, type);
      } else {
        return chooseRandomWithStorageType(
            scope, null, excludedNodes, type);
      }
    } finally {
      netlock.readLock().unlock();
    }
  }
@Test
  public void testChooseRandomWithStorageTypeWithExcludedforNullCheck()
      throws Exception {
    HashSet<Node> excluded = new HashSet<>();

    excluded.add(new DatanodeInfoBuilder()
        .setNodeID(DatanodeID.EMPTY_DATANODE_ID).build());
    Node node = CLUSTER.chooseRandomWithStorageType("/", "/l1/d1/r1", excluded,
        StorageType.ARCHIVE);

    assertNotNull(node);
  }