### Question:
MetricsConfig extends SubsetConfiguration { static MetricsConfig loadFirst(String prefix, String... fileNames) { for (String fname : fileNames) { try { Configuration cf = new PropertiesConfiguration(fname) .interpolatedConfiguration(); LOG.info("loaded properties from "+ fname); LOG.debug(toString(cf)); MetricsConfig mc = new MetricsConfig(cf, prefix); LOG.debug(mc); return mc; } catch (ConfigurationException e) { if (e.getMessage().startsWith("Cannot locate configuration")) { continue; } throw new MetricsConfigException(e); } } LOG.warn("Cannot locate configuration: tried "+ Joiner.on(",").join(fileNames)); return new MetricsConfig(new PropertiesConfiguration(), prefix); } MetricsConfig(Configuration c, String prefix); @Override MetricsConfig subset(String prefix); @Override Object getProperty(String key); @Override void clear(); @Override String toString();  }### Answer:
@Test public void testLoadFirst() throws Exception { String filename = getTestFilename("hadoop-metrics2-p1"); new ConfigBuilder().add("p1.foo", "p1foo").save(filename); MetricsConfig mc = MetricsConfig.create("p1"); MetricsConfig mc2 = MetricsConfig.create("p1", "na1", "na2", filename); Configuration expected = new ConfigBuilder().add("foo", "p1foo").config; assertEq(expected, mc); assertEq(expected, mc2); }