import org.junit.Test;
public class FooTest {
static {
System.out.println("line1");
System.err.println("line2");
}
@Test
public void test1(){
// some test
System.out.println("line3");
System.err.println("line4");
throw new RuntimeException("Fail it");
}
}
it uses junit4
buck sets the output and err stream to something custom that is per test specific to map test & log
It has the non default (JVM 's default) outputstream setup for stdout and stderr so that line1, line2 are getting lose
buck is able to capture line3, line4
this static block is just for illustration actual code is a @org.junit.ClassRule
Is there anyway to capture this line1 & line2. Sometime it fails in ClassRule and we want to be able to surface the log messages to developers.
I have a Java project with a test similar to this
@org.junit.ClassRule
Is there anyway to capture this line1 & line2. Sometime it fails in ClassRule and we want to be able to surface the log messages to developers.