In envision everything in ConsoleRunnerImpl being non-static. This would become:
ConsoleRunnerImpl runner = new ConsoleRunnerImpl(); runner.setCallSystemExitOnFinish(false); runner.main(...); assertEquals(0, runner.getExitStatus();
The call to
setCallSystemExitOnFinish(false);is neccessasry. Right now, if your unit test fails,
pants testwill abort.
[Refator]Remove static declaration in junit to make junit testable.
Review Request #2406 — Created June 23, 2015 and discarded
|jsirois, stuhood, zundel|
In rb, https://rbcommons.com/s/twitter/r/2395/ i added tests to test console output.
However these tests would only run in isolation and fail in CI.
Eric pointed out, this could be due to stored static instances.
Refactoring this to add these tests in CI.
Found an interesting bug which delayed the rb https://github.com/pantsbuild/pants/issues/1727
./pants test.junit tests/java/org/pantsbuild/tools/junit::OK (23 tests)Waiting for background workers to finish.
09:40:05 00:05 [complete]
You have new mail in /var/mail/tdesai
[tw-mbp13-tdesai pants (fix_tests)]$