MainRunner installs a SecurityManager which traps the System.exit(), thereby
removing the need to have runMainAndExit and runMain public in JUnitCore.
MainRunner is only used in the tests of course.
The idea of this change is to remove the public methods runMainAndExit and runMain.
Added MainRunner. This removes the need for public methods in JUnitCore
I like this, in general. Can you run some github searches, and post quickly on junit-users, to make sure there are no non-test users of these methods?
Posted to junit group, the github search reveals two projects:
https://github.com/SteMo/Zeiterfassung_HiWis_TUD (single use)
https://github.com/gliptak/JAllele (mutliple uses, but > 2 years since last update)
This security manager may cause some trouble. I learned it the hard way on my System Rules project :-) What you should use is something like https://github.com/stefanbirkner/system-rules/blob/master/src/main/java/org/junit/contrib/java/lang/system/internal/NoExitSecurityManager.java
You can copy the code. It's mine.
Thanks for that. I'll incorporate it when I've got half an hour. What were the problems that you encountered? Anything I should know about, or just that we should be delegating everything to the original security manager?
Somebody I know had problems with tests, that test JMX functionality.
Use SecurityManager recommended by Stefan Birkner