gshute.ioutil
Class Tester

java.lang.Object
  |
  +--gshute.ioutil.Tester
Direct Known Subclasses:
CircularListTester, DictionaryTester, DispenserTester, FormattingTester, RandomAccessTester, SearchTreeTester, TableTester

public class Tester
extends java.lang.Object

Class Tester is a base class for line-oriented, command-driven, interactive and batch testing.


Field Summary
protected  LineStream commandStream
          commandStream is the LineStream from which this Tester reads commands.
protected  CommandTable commandTable
          commandTable is the table of Commands that this Tester can execute.
protected  java.lang.String prompt
          prompt is the prompt that this Tester uses for interactive input.
 
Constructor Summary
Tester()
          Tester() returns a new Tester.
 
Method Summary
 void addCommands()
          addCommands() adds testing commands to the command table.
 void doCommands()
          doCommands() executes commands from the command stream.
static void main(java.lang.String[] args)
          If this program is executed with no command line argument then it executes commands entered from the terminal.
 void openStream(java.lang.String[] args)
          openStream(args) checks the command line for a correct number of arguments and opens a source file if specified.
 void startInteractive()
          startInteractive() prints messages to the interactive user describing how to use the program.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commandStream

protected LineStream commandStream
commandStream is the LineStream from which this Tester reads commands.

commandTable

protected CommandTable commandTable
commandTable is the table of Commands that this Tester can execute.

prompt

protected java.lang.String prompt
prompt is the prompt that this Tester uses for interactive input.
Constructor Detail

Tester

public Tester()
Tester() returns a new Tester.
Method Detail

addCommands

public void addCommands()
addCommands() adds testing commands to the command table.

startInteractive

public void startInteractive()
startInteractive() prints messages to the interactive user describing how to use the program.

openStream

public void openStream(java.lang.String[] args)
                throws java.io.FileNotFoundException,
                       java.io.IOException
openStream(args) checks the command line for a correct number of arguments and opens a source file if specified.

doCommands

public void doCommands()
                throws java.io.IOException
doCommands() executes commands from the command stream.

main

public static void main(java.lang.String[] args)
                 throws java.io.FileNotFoundException,
                        java.io.IOException
If this program is executed with no command line argument then it executes commands entered from the terminal. If this program is executed with a single command-line argument then that argument is interpreted as a file name. The program attempts to open the named file and execute the commands in it. If the open fails, or if there is more than one command-line argument, then the program terminates with an error message.