@Test
public void test120() throws Exception {
byte[] buffer;
ByteArrayOutputStream stream = new ByteArrayOutputStream();
CsvWriter writer = new CsvWriter(stream, ',', Charset
.forName("ISO-8859-1"));
writer.write("1,2");
writer.endRecord();
buffer = stream.toByteArray();
String data = Charset.forName("ISO-8859-1").decode(
ByteBuffer.wrap(buffer)).toString();
Assert.assertEquals("", data);
writer.flush(); // testing that flush flushed to stream
buffer = stream.toByteArray();
stream.close();
data = Charset.forName("ISO-8859-1").decode(ByteBuffer.wrap(buffer))
.toString();
Assert.assertEquals("\"1,2\"\r\n", data);
writer.close();
}