Search in sources :

Example 1 with MockPrintWriter

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

the class CharByteReadWriteTest method testPrintWriter.

@Test
public void testPrintWriter() throws Throwable {
    String file = "PrintWriter_file.tmp";
    String expected = "testPrintWriter";
    MockPrintWriter out = new MockPrintWriter(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) MockPrintWriter(org.evosuite.runtime.mock.java.io.MockPrintWriter) 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 MockPrintWriter (org.evosuite.runtime.mock.java.io.MockPrintWriter)1 Test (org.junit.Test)1