public static YarnApplicationAttemptState convertRmAppAttemptStateToYarnApplicationAttemptState(
      RMAppAttemptState currentState,
      RMAppAttemptState previousState
  ) {
    return createApplicationAttemptState(
        currentState == RMAppAttemptState.FINAL_SAVING
        ? previousState
        : currentState
    );
  }
@Test
  public void testConvertRmAppAttemptStateToYarnApplicationAttemptState() {
    Assert.assertEquals(
        YarnApplicationAttemptState.FAILED,
        RMServerUtils.convertRmAppAttemptStateToYarnApplicationAttemptState(
            RMAppAttemptState.FINAL_SAVING,
            RMAppAttemptState.FAILED
        )
    );
    Assert.assertEquals(
        YarnApplicationAttemptState.SCHEDULED,
        RMServerUtils.convertRmAppAttemptStateToYarnApplicationAttemptState(
            RMAppAttemptState.FINAL_SAVING,
            RMAppAttemptState.SCHEDULED
        )
    );
    Assert.assertEquals(
        YarnApplicationAttemptState.NEW,
        RMServerUtils.convertRmAppAttemptStateToYarnApplicationAttemptState(
            RMAppAttemptState.NEW,
            null
        )
    );
  }