Registry / testing / system-rules

system-rules

JSON →
library1.19.0javamavenunverified

A collection of JUnit rules for testing code that uses java.lang.System.

<dependency> <groupId>com.github.stefanbirkner</groupId> <artifactId>system-rules</artifactId> <version>1.19.0</version> </dependency>
INSTALL
IMPORT
SIG · SYSTEM-RULES
S
system-rules
testingjavav1.19.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SystemOutRule
org.junit.contrib.java.lang.system.SystemOutRule

Captures System.out output using a JUnit rule for testing.

import org.junit.Rule; import org.junit.Test; import org.junit.contrib.java.lang.system.SystemOutRule; public class MyTest { @Rule public final SystemOutRule systemOutRule = new SystemOutRule().enableLog(); @Test public void test() { System.out.print("hello"); assert systemOutRule.getLog().equals("hello"); } }
Debug
Known issues
breakingSystem Rules is not compatible with JUnit 5; use System Lambda or other alternatives.
fix
For JUnit 5, use com.github.stefanbirkner:system-lambda instead.
affects: >=1.19.0
Upgrade
Version history
1.19.0latest on Maven
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
system-rules — mvn dependency:get system-rules · libregistry