@Test (timeout = 30000)
public void testGetRealAuthenticationMethod() {

  UserGroupInformation ugi = UserGroupInformation.createRemoteUser("user1");
  ugi.setAuthenticationMethod(AuthenticationMethod.SIMPLE);
  assertEquals(AuthenticationMethod.SIMPLE, ugi.getAuthenticationMethod());
  assertEquals(AuthenticationMethod.SIMPLE, ugi.getRealAuthenticationMethod());
  ugi = UserGroupInformation.createProxyUser("user2", ugi);
  assertEquals(AuthenticationMethod.PROXY, ugi.getAuthenticationMethod());
  assertEquals(AuthenticationMethod.SIMPLE, ugi.getRealAuthenticationMethod());
}