[Refator]Remove static declaration in junit to make junit testable.

Review Request #2406 — Created June 23, 2015 and discarded

tejal
pants
1720
pants-reviews
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

https://travis-ci.org/pantsbuild/pants/builds/68038970

Locally:
./pants test.junit tests/java/org/pantsbuild/tools/junit::

                 OK (23 tests)

           Waiting for background workers to finish.

09:40:05 00:05 [complete]
SUCCESS
You have new mail in /var/mail/tdesai
[tw-mbp13-tdesai pants (fix_tests)]$

  1. 
      
  2. this should probably move out of static context too

  3. 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 test will abort.

  4. 
      
Review request changed

Status: Discarded

Loading...