How to test methods that call System.exit() Java method?

Posted by Jessica Taylor | Updated on

In this example, we will learn how to test methods that call System.exit() Java method? The library System Rules has a JUnit rule called ExpectedSystemExit. With this rule you are able to test code, that calls System.exit():


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers