Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
808b373d
Commit
808b373d
authored
Jul 17, 2019
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.1.x'
Closes gh-17552
parents
9d85dbad
9dabc0e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
4 deletions
+12
-4
MockMvcPrintOnlyOnFailureTestExecutionListener.java
...rvlet/MockMvcPrintOnlyOnFailureTestExecutionListener.java
+4
-3
SpringBootMockMvcBuilderCustomizer.java
...igure/web/servlet/SpringBootMockMvcBuilderCustomizer.java
+4
-0
WebMvcTestPrintDefaultIntegrationTests.java
...rvlet/mockmvc/WebMvcTestPrintDefaultIntegrationTests.java
+4
-1
No files found.
spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/MockMvcPrintOnlyOnFailureTestExecutionListener.java
View file @
808b373d
...
...
@@ -36,11 +36,12 @@ class MockMvcPrintOnlyOnFailureTestExecutionListener extends AbstractTestExecuti
@Override
public
void
afterTestMethod
(
TestContext
testContext
)
throws
Exception
{
if
(
testContext
.
getTestException
()
!=
null
)
{
DeferredLinesWriter
writer
=
DeferredLinesWriter
.
get
(
testContext
.
getApplicationContext
());
if
(
writer
!=
null
)
{
DeferredLinesWriter
writer
=
DeferredLinesWriter
.
get
(
testContext
.
getApplicationContext
());
if
(
writer
!=
null
)
{
if
(
testContext
.
getTestException
()
!=
null
)
{
writer
.
writeDeferredResult
();
}
writer
.
clear
();
}
}
...
...
spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/SpringBootMockMvcBuilderCustomizer.java
View file @
808b373d
...
...
@@ -253,6 +253,10 @@ public class SpringBootMockMvcBuilderCustomizer implements MockMvcBuilderCustomi
}
}
void
clear
()
{
this
.
lines
.
clear
();
}
}
/**
...
...
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/mockmvc/WebMvcTestPrintDefaultIntegrationTests.java
View file @
808b373d
...
...
@@ -16,7 +16,9 @@
package
org
.
springframework
.
boot
.
test
.
autoconfigure
.
web
.
servlet
.
mockmvc
;
import
org.junit.jupiter.api.MethodOrderer
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.TestMethodOrder
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.junit.platform.engine.discovery.DiscoverySelectors
;
...
...
@@ -43,6 +45,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
* @author Andy Wilkinson
*/
@ExtendWith
(
OutputCaptureExtension
.
class
)
@TestMethodOrder
(
MethodOrderer
.
Alphanumeric
.
class
)
class
WebMvcTestPrintDefaultIntegrationTests
{
@Test
...
...
@@ -54,7 +57,7 @@ class WebMvcTestPrintDefaultIntegrationTests {
@Test
void
shouldPrint
(
CapturedOutput
output
)
throws
Throwable
{
executeTests
(
ShouldPrint
.
class
);
assertThat
(
output
).
contains
(
"HTTP Method"
);
assertThat
(
output
).
contains
OnlyOnce
(
"HTTP Method"
);
}
private
void
executeTests
(
Class
<?>
testClass
)
throws
Throwable
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment