### Question:
Master { public static String getMasterUserName(Configuration conf) { String framework = conf.get(MRConfig.FRAMEWORK_NAME, MRConfig.YARN_FRAMEWORK_NAME); if (framework.equals(MRConfig.CLASSIC_FRAMEWORK_NAME)) { return conf.get(MRConfig.MASTER_USER_NAME); } else { return conf.get(YarnConfiguration.RM_PRINCIPAL); } }  static String getMasterUserName(Configuration conf); static InetSocketAddress getMasterAddress(Configuration conf); static String getMasterPrincipal(Configuration conf);  }### Answer:
@Test public void testGetMasterUser() { YarnConfiguration conf = new YarnConfiguration(); conf.set(MRConfig.MASTER_USER_NAME, "foo"); conf.set(YarnConfiguration.RM_PRINCIPAL, "bar"); assertEquals(Master.getMasterUserName(conf), "bar"); conf.set(MRConfig.FRAMEWORK_NAME, MRConfig.CLASSIC_FRAMEWORK_NAME); assertEquals(Master.getMasterUserName(conf), "foo"); conf.set(MRConfig.FRAMEWORK_NAME, MRConfig.YARN_FRAMEWORK_NAME); assertEquals(Master.getMasterUserName(conf), "bar"); }