FileDocCategorySizeDatePackage
OutputTest.javaAPI DocGlassfish v2 API5042Fri May 04 22:25:30 BST 2007com.sun.enterprise.cli.framework

OutputTest

public class OutputTest extends TestCase
author
Toby H Ferguson
version
$Revision: 1.5 $

Fields Summary
Constructors Summary
public OutputTest(String name)

        super(name);
    
Methods Summary
public static voidmain(java.lang.String[] args)

        if (args.length == 0){
            junit.textui.TestRunner.run(OutputTest.class);
        } else {
            junit.textui.TestRunner.run(makeSuite(args));
        }
    
private static junit.framework.TestSuitemakeSuite(java.lang.String[] args)

        final TestSuite ts = new TestSuite();
        for (int i = 0; i < args.length; i++){
            ts.addTest(new OutputTest(args[i]));
        }
        return ts;
    
private voidnyi()

        fail("Not Yet Implemented");
    
protected voidsetUp()

    
protected voidtearDown()

    
public voidtestClosedWhenDone()

        final TestStream ts = new TestStream();
        final Output out = new Output(ts, true);
        out.close();
        assertTrue("Expected test stream to be closed", ts.isClosed());
    
public voidtestNotClosedWhenDone()

        final TestStream ts = new TestStream();
        final Output out = new Output(ts, false);
        out.close();
        assertTrue("Expected test stream to still be open", !ts.isClosed());
    
public voidtestPrintObject()

        final ByteArrayOutputStream bout = new ByteArrayOutputStream();
        final Output out = new Output(bout, true);
        final Object o = new Object();
        out.print(o);
        out.flush();
        //need to add "\n" at the end since bout.toString() returns a newline at the end
        assertEquals(o.toString()+"\n", bout.toString());
    
public voidtestPrintln()

        final ByteArrayOutputStream bout = new ByteArrayOutputStream();
        final Output out = new Output(bout, true);
        out.println("m");
        out.flush();
        assertEquals("m" + System.getProperty("line.separator"), bout.toString());
    
public voidtestPrintlnObject()

        final ByteArrayOutputStream bout = new ByteArrayOutputStream();
        final Output out = new Output(bout, true);
        final Object o = new Object();
        out.println(o);
        out.flush();
        assertEquals(o.toString() + System.getProperty("line.separator"), bout.toString());
    
public voidtestSimpleUse()

        final ByteArrayOutputStream bout = new ByteArrayOutputStream();
        final Output out = new Output(bout, true);
        out.print("m");
        out.flush();
        assertEquals("m", bout.toString());