@Test
  public void testBadFormat() throws Exception {
    StringWriter sw = new StringWriter();
    try {
      ConfServlet.writeResponse(getTestConf(), sw, "not a format");
      fail("writeResponse with bad format didn't throw!");
    } catch (ConfServlet.BadFormatException bfe) {
      // expected
    }
    assertEquals("", sw.toString());
  }
Basic test case that the ConfServlet can write configuration to its output in XML and JSON
format.
hbase-http/src/test/java/org/apache/hadoop/hbase/http/conf/TestConfServlet.java