org.jwalk.test
Class InputReader
java.lang.Object
org.jwalk.test.InputReader
public class InputReader
- extends java.lang.Object
InputReader has methods to read integers and strings from standard input.
This is a standard test class, provided with the JWalk tool suite.
InputReader is provided solely in order to demonstrate JWalk's ability to
handle classes that would normally require the user to enter keyboard input
to System.in. It has one method, getString()
which prompts for
input. If you exercise this class using the default JWalker configuration,
you would have to enter large amounts of keyboard input, which is tedious!
Instead, you should first load the custom generator RedirectInGenerator.
This generator takes control of standard input, and redirects this to a text
file called "input.txt", in the same directory as the current test class.
The data in this file is used, again and again, for each test sequence,
instead of the user having to enter large amounts of keyboard input. Note,
from the prompts appearing in the output, how many times you would be asked
for input! If no such file exists, a dummy "input.txt" file is created,
which can later be edited by the user to contain whatever data is expected.
Using the RedirectInGenerator is especially important in the ALGEBRA or
STATES test strategies, because JWalkers may probe the behaviour of the test
class to great depths during the initial analysis stage. It is likely that
the default probe depth will lead to running out of memory, so this may need
to be set to a lower value.
- Version:
- 1.0
- Author:
- Anthony Simons
Constructor Summary |
InputReader()
Creates an InputReader and opens a reader onto System.in. |
Method Summary |
java.lang.String |
getString()
Reads a single input line and returns this as a String. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InputReader
public InputReader()
- Creates an InputReader and opens a reader onto System.in.
getString
public java.lang.String getString()
throws java.io.IOException
- Reads a single input line and returns this as a String.
- Returns:
- the whole of the input line, as a String.
- Throws:
java.io.IOException
- if no input could be read.