junit.contrib的包在
<dependency>
<groupId>com.github.stefanbirkner</groupId>
<artifactId>system-rules</artifactId>
<version>1.16.1</version>
<scope>test</scope>
</dependency>
使用
@Rule
public final SystemOutRule log = new SystemOutRule();
@Rule
public final StandardOutputStreamLog l = new StandardOutputStreamLog();//已废弃
l.getLog();
log.getLog();