Scala: How to test methods that call System.exit()?
问题 I have been developing a command-line tool which calls System.exit() ( don't want to use exceptions instead of ) on certain inputs. I am familiar with Java: How to test methods that call System.exit()? and its the most elegant approach. Unfortunately, it is not enough pure, due to I had to add the dependencies to system-rules, junit-interface Is there any common pattern for dealing with System.exit in specs2 which is more pure than my current approach which don't use specs2 ? import org.junit