Methods Summary |
---|
public static void | main(java.lang.String[] args)
if (args.length == 0){
junit.textui.TestRunner.run(InputsAndOutputsTest.class);
} else {
junit.textui.TestRunner.run(makeSuite(args));
}
|
private static junit.framework.TestSuite | makeSuite(java.lang.String[] args)
final TestSuite ts = new TestSuite();
for (int i = 0; i < args.length; i++){
ts.addTest(new InputsAndOutputsTest(args[i]));
}
return ts;
|
private void | nyi()
fail("Not Yet Implemented");
|
protected void | setUp()
io = InputsAndOutputs.getInstance();
|
protected void | tearDown()
|
public void | testAssignment()
io.setInstance(InputsAndOutputs.getInstance());
assertEquals(io, InputsAndOutputs.getInstance());
|
public void | testConstruction()
assertNotNull(io.getUserOutput());
|
public void | testSetGetErrorOutputStream()
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
io.setErrorOutput(baos);
final IErrorOutput uo = io.getErrorOutput();
uo.print("foo");
uo.close();
assertEquals("foo", baos.toString());
|
public void | testSetGetUserErrorStreamToFile()
final File f = File.createTempFile("InputsAndOutputsTest_testSetGetUserOutputStreamToFile", "tmp");
f.deleteOnExit();
io.setErrorOutputFile(f.toString());
final IErrorOutput uo = io.getErrorOutput();
uo.println("foo");
uo.close();
final BufferedReader fr= new BufferedReader(new FileReader(f));
assertEquals("foo", fr.readLine());
|
public void | testSetGetUserInput()
final ByteArrayInputStream in = new ByteArrayInputStream("one\ntwo".getBytes());
final UserInput ui = new UserInput(in);
io.setUserInput(ui);
assertEquals(ui, io.getUserInput());
assertEquals("one", io.getUserInput().getLine());
|
public void | testSetGetUserInputEncoding()
final ByteArrayInputStream in = new ByteArrayInputStream("one\ntwo".getBytes());
io.setUserInput(in, "ISO-8859-1");
final IUserInput ui = io.getUserInput();
assertEquals("one", ui.getLine());
|
public void | testSetGetUserInputStream()
final ByteArrayInputStream in = new ByteArrayInputStream("one\ntwo".getBytes());
io.setUserInput(in);
final IUserInput ui = io.getUserInput();
assertEquals("one", ui.getLine());
|
public void | testSetGetUserOutputStream()
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
io.setUserOutput(baos);
final IUserOutput uo = io.getUserOutput();
uo.print("foo");
// uo.close();
assertEquals("foo", baos.toString());
|
public void | testSetGetUserOutputStreamToFile()
final File f = File.createTempFile("InputsAndOutputsTest_testSettingOutputStreamToFile", "tmp");
f.deleteOnExit();
io.setUserOutputFile(f.toString());
final IUserOutput uo = io.getUserOutput();
uo.println("foo");
// uo.close();
final BufferedReader fr= new BufferedReader(new FileReader(f));
assertEquals("foo", fr.readLine());
|
public void | testSettingUserInputFile()
final File f = File.createTempFile("InputsAndOutputsTest_testSettingUserInputFile", "tmp");
f.deleteOnExit();
final PrintWriter pw = new PrintWriter(new FileWriter(f));
pw.println("line one");
pw.println("line two");
pw.close();
io.setUserInputFile(f.toString());
final IUserInput ui = io.getUserInput();
assertEquals("line one", ui.getLine());
assertEquals("line two", ui.getLine());
assertNull(ui.getLine());
|
public void | testSettingUserInputFileWithEncoding()
final String enc = "ISO-8859-1";
final File f = File.createTempFile("InputsAndOutputsTest_testSettingUserInputFileWithEncoding", "tmp");
f.deleteOnExit();
final PrintWriter pw = new PrintWriter (new OutputStreamWriter(new FileOutputStream(f), enc));
pw.println("line one");
pw.println("line two");
pw.close();
io.setUserInputFile(f.toString(), enc);
final IUserInput ui = io.getUserInput();
assertEquals("line one", ui.getLine());
assertEquals("line two", ui.getLine());
assertNull(ui.getLine());
|