FileDocCategorySizeDatePackage
LineOrientedOutputStreamTest.javaAPI DocApache Ant 1.704107Wed Dec 13 06:16:24 GMT 2006org.apache.tools.ant.util

LineOrientedOutputStreamTest

public class LineOrientedOutputStreamTest extends TestCase

Fields Summary
private static String
LINE
private DummyStream
stream
Constructors Summary
public LineOrientedOutputStreamTest(String name)


       
        super(name);
    
Methods Summary
public voidsetUp()

        stream = new DummyStream();
    
public voidtearDown()

        if (stream != null) {
            stream.close();
        }
    
public voidtestCloseArray()

        writeByteArray();
        stream.close();
        stream.assertInvoked();
        stream = null;
    
public voidtestCloseSingleBytes()

        writeSingleBytes();
        stream.close();
        stream.assertInvoked();
        stream = null;
    
public voidtestFlushArray()

        writeByteArray();
        stream.flush();
        stream.assertInvoked();
    
public voidtestFlushSingleBytes()

        writeSingleBytes();
        stream.flush();
        stream.assertInvoked();
    
public voidtestLineWithCariagereturnArray()

        writeByteArray();
        writeAsArray('\r");
        stream.assertInvoked();
    
public voidtestLineWithCariagereturnLinefeedArray()

        writeByteArray();
        writeAsArray('\r");
        writeAsArray('\n");
        stream.assertInvoked();
    
public voidtestLineWithCariagereturnLinefeedSingleBytes()

        writeSingleBytes();
        stream.write('\r");
        stream.write('\n");
        stream.assertInvoked();
    
public voidtestLineWithCariagereturnSingleBytes()

        writeSingleBytes();
        stream.write('\r");
        stream.assertInvoked();
    
public voidtestLineWithLinefeedArray()

        writeByteArray();
        writeAsArray('\n");
        stream.assertInvoked();
    
public voidtestLineWithLinefeedSingleBytes()

        writeSingleBytes();
        stream.write('\n");
        stream.assertInvoked();
    
private voidwriteAsArray(char c)

        stream.write(new byte[] {(byte) c}, 0, 1);
    
private voidwriteByteArray()

        stream.write(LINE.getBytes(), 0, LINE.length());
    
private voidwriteSingleBytes()

        byte[] b = LINE.getBytes();
        for (int i = 0; i < b.length; i++) {
            stream.write(b[i]);
        }