@Test
  public void testPreviousStageToFailForFirstStage() throws Exception {
    Stage nextStage = createNiceMock(Stage.class);

    expect(nextStage.getStageId()).andReturn(0L);

    ActionScheduler scheduler = new ActionScheduler(100, 50, null, null, 3,
        new HostsMap((String) null), null, null, null, entityManagerProviderMock, null, null, null);

    replay(nextStage);

    Method method = scheduler.getClass().getDeclaredMethod("hasPreviousStageFailed", Stage.class);
    method.setAccessible(true);
    Object result = method.invoke(scheduler, nextStage);

    assertFalse((Boolean) result);
    EasyMock.verify(nextStage);
  }
Tests that command failures in skippable stages do not cause the request to
be aborted.
ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java