mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-24 18:29:03 +00:00
Split up JUnit 5 OutputCapture class
Split the JUnit 5 `OutputCapture` class into separate `OutputExtension` and `CapturedOutput` classes. The JUnit 5 callback methods are now contained only in the `OutputExtension` class so no longer pollute the public API that users will interact with. The `CapturedOutput` class has also been updated to capture System.err and System.out separately to allow distinct assertions if required. Closes gh-17029
This commit is contained in:
+3
-2
@@ -19,14 +19,15 @@ package sample.logback;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
|
||||
import org.springframework.boot.test.extension.OutputCapture;
|
||||
import org.springframework.boot.test.extension.CapturedOutput;
|
||||
import org.springframework.boot.test.extension.OutputExtension;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class SampleLogbackApplicationTests {
|
||||
|
||||
@RegisterExtension
|
||||
OutputCapture output = new OutputCapture();
|
||||
CapturedOutput output = OutputExtension.capture();
|
||||
|
||||
@Test
|
||||
void testLoadedCustomLogbackConfig() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user