@Test
public void testChooseDataNode() {

  Collection<Node> allNodes = new ArrayList<>(dataNodes.length);
  Collections.addAll(allNodes, dataNodes);
  if (placementPolicy instanceof AvailableSpaceBlockPlacementPolicy) {
    // exclude all datanodes when chooseDataNode, no NPE should be thrown
    ((AvailableSpaceBlockPlacementPolicy) placementPolicy)
        .chooseDataNode("~", allNodes);
  }
}