public void writeXml(OutputStream out) throws IOException {
    writeXml(new OutputStreamWriter(out, StandardCharsets.UTF_8));
  }
@Test
  public void testWriteXml() throws IOException {
    Configuration conf = new Configuration();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    conf.writeXml(baos);
    String result = baos.toString();
    assertTrue("Result has proper header", result.startsWith(XMLHEADER));

    assertTrue("Result has proper footer", result.endsWith("</configuration>"));
  }