Search in sources :

Example 1 with MockPrintStream

use of org.evosuite.runtime.mock.java.io.MockPrintStream in project evosuite by EvoSuite.

the class CharByteReadWriteTest method testPrintStream.

@Test
public void testPrintStream() throws Throwable {
    String file = "PrintStream_file.tmp";
    String expected = "testPrintStream";
    MockPrintStream out = new MockPrintStream(file);
    out.println(expected);
    out.close();
    Scanner in = new Scanner(new MockFileInputStream(file));
    String result = in.nextLine();
    in.close();
    Assert.assertEquals(expected, result);
}
Also used : Scanner(java.util.Scanner) MockPrintStream(org.evosuite.runtime.mock.java.io.MockPrintStream) MockFileInputStream(org.evosuite.runtime.mock.java.io.MockFileInputStream) Test(org.junit.Test)

Aggregations

Scanner (java.util.Scanner)1 MockFileInputStream (org.evosuite.runtime.mock.java.io.MockFileInputStream)1 MockPrintStream (org.evosuite.runtime.mock.java.io.MockPrintStream)1 Test (org.junit.Test)1