### Question:
StaticUserWebFilter extends FilterInitializer { static String getUsernameFromConf(Configuration conf) { String oldStyleUgi = conf.get(DEPRECATED_UGI_KEY); if (oldStyleUgi != null) { LOG.warn(DEPRECATED_UGI_KEY + " should not be used. Instead, use " + USERNAME_KEY + "."); String[] parts = oldStyleUgi.split(","); return parts[0]; } else { return conf.get(USERNAME_KEY, USERNAME_DEFAULT); } }  @Override void initFilter(FilterContainer container, Configuration conf);  }### Answer:
@Test public void testOldStyleConfiguration() { Configuration conf = new Configuration(); conf.set("dfs.web.ugi", "joe,group1,group2"); assertEquals("joe", StaticUserWebFilter.getUsernameFromConf(conf)); }
@Test public void testConfiguration() { Configuration conf = new Configuration(); conf.set(StaticUserWebFilter.USERNAME_KEY, "joe"); assertEquals("joe", StaticUserWebFilter.getUsernameFromConf(conf)); }