public class CRLFOutputStreamTest {
@org.junit.Test
public void testBytePerByte() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
CRLFOutputStream crlfOutputStream = new CRLFOutputStream(baos);
crlfOutputStream.write('\n');
crlfOutputStream.write('\r');
crlfOutputStream.write('\r');
crlfOutputStream.write('\n');
crlfOutputStream.write('\n');
crlfOutputStream.write('\n');
crlfOutputStream.write('\r');
crlfOutputStream.write('\r');
crlfOutputStream.write('\r');
crlfOutputStream.write('a');
crlfOutputStream.write('\n');
crlfOutputStream.write('\r');
crlfOutputStream.write('\n');
crlfOutputStream.write('a');
crlfOutputStream.write('a');
crlfOutputStream.write('a');
crlfOutputStream.close();
Assert.assertArrayEquals("\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\na\r\n\r\naaa".getBytes(), baos.toByteArray());
}