@Test
  @SuppressWarnings("unchecked")
  public void testGetTasksRecursion() {

    Task<MapredWork> rootTask = getMapredWork();
    Task<MapredWork> child1 = getMapredWork();
    Task<MapredWork> child2 = getMapredWork();
    Task<MapredWork> child11 = getMapredWork();

    rootTask.addDependentTask(child1);
    rootTask.addDependentTask(child2);
    child1.addDependentTask(child11);

    assertEquals(Lists.newArrayList(rootTask, child1, child2, child11),
        Utilities.getMRTasks(getTestDiamondTaskGraph(rootTask)));

  }
This test tests that Utilities.get*Tasks do not repeat themselves in the process
of extracting tasks from a given set of root tasks when given DAGs that can have
multiple paths, such as the case with Diamond-shaped DAGs common to replication.
ql/src/test/org/apache/hadoop/hive/ql/exec/TestUtilities.java