ConfigurationUtils { public static void load(Configuration conf, InputStream is) throws IOException { try { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); docBuilderFactory.setIgnoringComments(true); DocumentBuilder builder = docBuilderFactory.newDocumentBuilder(); Document doc = builder.parse(is); parseDocument(conf, doc); } catch (SAXException | ParserConfigurationException e) { throw new IOException(e); } }  static void copy(Configuration source, Configuration target); static void injectDefaults(Configuration source,
      Configuration target); static Configuration resolve(Configuration conf); static void load(Configuration conf, InputStream is);  }
@Test public void constructors() throws Exception { Configuration conf = new Configuration(false); assertEquals(conf.size(), 0); byte[] bytes = "<configuration><property><name>a</name><value>A</value></property></configuration>" .getBytes(); InputStream is = new ByteArrayInputStream(bytes); conf = new Configuration(false); ConfigurationUtils.load(conf, is); assertEquals(conf.size(), 1); assertEquals(conf.get("a"), "A"); }
@Test(expected = IOException.class) public void constructorsFail3() throws Exception { InputStream is = new ByteArrayInputStream("<xonfiguration></xonfiguration>".getBytes()); Configuration conf = new Configuration(false); ConfigurationUtils.load(conf, is); }