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

MoreTest

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

Fields Summary
final String
quitChar
final String
prompt
Pipe
toUser
Pipe
destination
Constructors Summary
public MoreTest(String name)

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

        if (args.length == 0){
            junit.textui.TestRunner.run(MoreTest.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 MoreTest(args[i]));
        }
        return ts;
    
private voidnyi()

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

    
         
        toUser = new Pipe();
        destination = new Pipe();
    
protected voidtearDown()

    
public voidtestEmptyInput()

        final More m = new More(1, new StringReader(""), destination.getWriter(), new StringReader("\n123\nx\n"), toUser.getWriter(), quitChar, prompt);
        assertTrue(!destination.getReader().ready());
    
public voidtestShortInput()

        final More m = new More(3, new StringReader("1\n2\n"), destination.getWriter(), new StringReader("\n123\nx\n"), toUser.getWriter(), quitChar, prompt);
        assertEquals("1", destination.readLine());
        assertTrue(!toUser.getReader().ready());
    
public voidtestSimpleUsage()

        final More m = new More(1, new StringReader("1\n2\n3\n4"), destination.getWriter(), new StringReader("\n123\nx\n"), toUser.getWriter(), quitChar, prompt);
        
        assertEquals("1", destination.readLine());
        assertEquals(prompt, toUser.readLine());
        assertEquals("2", destination.readLine());
        assertEquals(prompt, toUser.readLine());
        assertEquals("3", destination.readLine());
        assertEquals(prompt, toUser.readLine());
        assertTrue(!destination.getReader().ready());