Code example for StringWriter

Methods: toString

0
    assertTrue(foundSetting);
  } 
 
  @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());
  } 
} 
Contextual code suggestions in your IDE  Get Codota for Java