|
|
|
@ -18,6 +18,7 @@ package org.springframework.test.web.servlet.assertj; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.ByteArrayOutputStream; |
|
|
|
import java.io.ByteArrayOutputStream; |
|
|
|
import java.io.PrintStream; |
|
|
|
import java.io.PrintStream; |
|
|
|
|
|
|
|
import java.io.StringWriter; |
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
@ -357,6 +358,15 @@ public class MockMvcTesterIntegrationTests { |
|
|
|
assertThat(capturedOut()).isEmpty(); |
|
|
|
assertThat(capturedOut()).isEmpty(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
void debugCanPrintToCustomWriter() { |
|
|
|
|
|
|
|
StringWriter out = new StringWriter(); |
|
|
|
|
|
|
|
assertThat(mvc.get().uri("/greet")).debug(out).hasStatusOk(); |
|
|
|
|
|
|
|
assertThat(out.toString()) |
|
|
|
|
|
|
|
.contains("MockHttpServletRequest:", "MockHttpServletResponse:"); |
|
|
|
|
|
|
|
assertThat(capturedOut()).isEmpty(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String capturedOut() { |
|
|
|
private String capturedOut() { |
|
|
|
return this.capturedOut.toString(StandardCharsets.UTF_8); |
|
|
|
return this.capturedOut.toString(StandardCharsets.UTF_8); |
|
|
|
} |
|
|
|
} |
|
|
|
|