W
White Spirit
I'm writing a unit test for a logger class that writes to stdout. The
logger class uses an OutputStreamWriter to wrap FileDescriptor.out:
mOut = new OutputStreamWriter(new
FileOutputStream(FileDescriptor.out), "UTF-8");
My unit test instantiates the logger class as a local object. When I
try to read from FileDescriptor.out in my unit test class, however,
nothing is received:
BufferedReader reader = new BufferedReader( new InputStreamReader( new
FileInputStream( FileDescriptor.out ) ) );
// do some logging
// ...
String n = reader.readLine();
Is there any way of reading what the logger is outputting?
logger class uses an OutputStreamWriter to wrap FileDescriptor.out:
mOut = new OutputStreamWriter(new
FileOutputStream(FileDescriptor.out), "UTF-8");
My unit test instantiates the logger class as a local object. When I
try to read from FileDescriptor.out in my unit test class, however,
nothing is received:
BufferedReader reader = new BufferedReader( new InputStreamReader( new
FileInputStream( FileDescriptor.out ) ) );
// do some logging
// ...
String n = reader.readLine();
Is there any way of reading what the logger is outputting?