ElementWriter { public void setWriter(final Writer aWriter) { if (aWriter == null) { throw new IllegalArgumentException("null writer given"); } this.myWriter = aWriter; } protected  ElementWriter(final String anElementName,
                            final int anIndentionLevel); void setWriter(final Writer aWriter);  }
@Test public void testBasic() throws IOException { MyElementWriter elementWriter; StringWriter stringWriter; BufferedWriter bufferedWriter; stringWriter = new StringWriter(); bufferedWriter = new BufferedWriter(stringWriter); elementWriter = new MyElementWriter(); elementWriter.setWriter(bufferedWriter); elementWriter.buildContent(); bufferedWriter.close(); Assert.assertEquals( "Generated xml is incorrect.", " <testElement myAttribute=\"ValueBeginValueEnd\"/>" + System.getProperty("line.separator"), stringWriter.toString()); }