You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the very least, there should be some documentation describing how one is expected to test applications built with picocli. However, much can be improved by never calling System.exit, but instead deferring this to the actual application. This way, one can easily test applications by asserting on exit codes. This is currently possible in JCommander for example. Something similar to the Spring Boot starter's ExitStatus is what I'm thinking.
The text was updated successfully, but these errors were encountered:
I'm not sure that I understand the problem: picocli only calls System.exit if requested by the application, as documented here: http://picocli.info/#_exit_code . If the andExit(int) method is not called, picocli will not call System.exit.
Good point about documenting how to test picocli-based applications. This topic came up before (see #218) and it's on my todo list to write an article about testing.
To give you a quick tip: I've started to use Stephan Birkner's SystemErrAndOutRule and ExpectedSystemExit rule. This works very well for JUnit 4. If you using JUnit 5, and you need this urgently, you can offer Stefan to help with his work in progress on a JUnit 5 extension.
At the very least, there should be some documentation describing how one is expected to test applications built with picocli. However, much can be improved by never calling
System.exit
, but instead deferring this to the actual application. This way, one can easily test applications by asserting on exit codes. This is currently possible in JCommander for example. Something similar to the Spring Boot starter'sExitStatus
is what I'm thinking.The text was updated successfully, but these errors were encountered: