Browse Source

Merge branch '2.7.x'

Closes gh-33416
pull/33418/head
Phillip Webb 3 years ago
parent
commit
e1efdadfe3
  1. 23
      spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/system/OutputCaptureRuleTests.java

23
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/system/OutputCaptureRuleTests.java

@ -37,6 +37,29 @@ public class OutputCaptureRuleTests { @@ -37,6 +37,29 @@ public class OutputCaptureRuleTests {
assertThat(this.output.toString()).contains("Hello World");
}
@Test
public void getAllShouldReturnAllCapturedOutput() {
System.out.println("Hello World");
System.err.println("Hello Error");
assertThat(this.output.getAll()).contains("Hello World", "Hello Error");
}
@Test
public void getOutShouldOnlyReturnOutputCapturedFromSystemOut() {
System.out.println("Hello World");
System.err.println("Hello Error");
assertThat(this.output.getOut()).contains("Hello World");
assertThat(this.output.getOut()).doesNotContain("Hello Error");
}
@Test
public void getErrShouldOnlyReturnOutputCapturedFromSystemErr() {
System.out.println("Hello World");
System.err.println("Hello Error");
assertThat(this.output.getErr()).contains("Hello Error");
assertThat(this.output.getErr()).doesNotContain("Hello World");
}
@Test
public void captureShouldBeAssertable() {
System.out.println("Hello World");

Loading…
Cancel
Save