#608
[JUnit] Test System.exit value
public class TestClass { @Rule public final ExpectedSystemExit exit = ExpectedSystemExit.none(); @Test public void test1() { exit.expectSystemExitWithStatus(1); // Call method with exit status ClassWithExitReturn.execute(); } }
Maven dependency :
<dependency> <groupId>com.github.stefanbirkner</groupId> <artifactId>system-rules</artifactId> <version>1.5.0</version> </dependency>
[Java] Tutorials [JUnit] Test System.err and System.out content
Comments are currently closed.