@Test
public void testGetRMPrincipalStandAlone_String() throws IOException {

  Configuration conf = new Configuration();
  conf.set(YarnConfiguration.RM_ADDRESS, "myhost");
  conf.setBoolean(YarnConfiguration.RM_HA_ENABLED, false);
  String result = YarnClientUtils.getRmPrincipal("test/_HOST@REALM", conf);
  assertEquals("The hostname translation did not produce the expected "
      + "results: " + result, "test/myhost@REALM", result);
  result = YarnClientUtils.getRmPrincipal("test/yourhost@REALM", conf);
  assertEquals("The hostname translation did not produce the expected "
      + "results: " + result, "test/yourhost@REALM", result);
  try {
    result = YarnClientUtils.getRmPrincipal(null, conf);
    fail("The hostname translation succeeded even though the RM principal "
        + "was null: " + result);
  } catch (IllegalArgumentException ex) {
    // Expected
  }
}