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
cc5d4b8b
Commit
cc5d4b8b
authored
Feb 06, 2016
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add AssertJ checkstyle rule
Closes gh-5083
parent
c5add2ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
checkstyle.xml
spring-boot-parent/src/checkstyle/checkstyle.xml
+8
-1
OutputCapture.java
...ain/java/org/springframework/boot/test/OutputCapture.java
+2
-2
No files found.
spring-boot-parent/src/checkstyle/checkstyle.xml
View file @
cc5d4b8b
...
@@ -71,7 +71,7 @@
...
@@ -71,7 +71,7 @@
<module
name=
"AvoidStarImport"
/>
<module
name=
"AvoidStarImport"
/>
<module
name=
"AvoidStaticImport"
>
<module
name=
"AvoidStaticImport"
>
<property
name=
"excludes"
<property
name=
"excludes"
value=
"org.junit.Assert.*, org.junit.Assume.*, org.junit.internal.matchers.ThrowableMessageMatcher.*, org.hamcrest.CoreMatchers.*, org.hamcrest.Matchers.*, org.springframework.boot.configurationprocessor.ConfigurationMetadataMatchers.*, org.springframework.boot.configurationprocessor.TestCompiler.*, org.mockito.Mockito.*, org.mockito.BDDMockito.*, org.mockito.Matchers.*, org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*, org.springframework.test.web.servlet.result.MockMvcResultMatchers.*, org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.*, org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.*, org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo"
/>
value=
"org.
assertj.core.api.Assertions.*, org.
junit.Assert.*, org.junit.Assume.*, org.junit.internal.matchers.ThrowableMessageMatcher.*, org.hamcrest.CoreMatchers.*, org.hamcrest.Matchers.*, org.springframework.boot.configurationprocessor.ConfigurationMetadataMatchers.*, org.springframework.boot.configurationprocessor.TestCompiler.*, org.mockito.Mockito.*, org.mockito.BDDMockito.*, org.mockito.Matchers.*, org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*, org.springframework.test.web.servlet.result.MockMvcResultMatchers.*, org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.*, org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.*, org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo"
/>
</module>
</module>
<module
name=
"IllegalImport"
/>
<module
name=
"IllegalImport"
/>
<module
name=
"RedundantImport"
/>
<module
name=
"RedundantImport"
/>
...
@@ -136,6 +136,13 @@
...
@@ -136,6 +136,13 @@
value=
"Please use BDDMockto imports."
/>
value=
"Please use BDDMockto imports."
/>
<property
name=
"ignoreComments"
value=
"true"
/>
<property
name=
"ignoreComments"
value=
"true"
/>
</module>
</module>
<module
name=
"RegexpSinglelineJava"
>
<property
name=
"maximum"
value=
"0"
/>
<property
name=
"format"
value=
"org\.junit\.Assert\.assert"
/>
<property
name=
"message"
value=
"Please use AssertJ imports."
/>
<property
name=
"ignoreComments"
value=
"true"
/>
</module>
<module
name=
"Regexp"
>
<module
name=
"Regexp"
>
<property
name=
"format"
value=
"[ \t]+$"
/>
<property
name=
"format"
value=
"[ \t]+$"
/>
<property
name=
"illegalPattern"
value=
"true"
/>
<property
name=
"illegalPattern"
value=
"true"
/>
...
...
spring-boot/src/main/java/org/springframework/boot/test/OutputCapture.java
View file @
cc5d4b8b
...
@@ -24,6 +24,7 @@ import java.util.ArrayList;
...
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.List
;
import
org.hamcrest.Matcher
;
import
org.hamcrest.Matcher
;
import
org.junit.Assert
;
import
org.junit.rules.TestRule
;
import
org.junit.rules.TestRule
;
import
org.junit.runner.Description
;
import
org.junit.runner.Description
;
import
org.junit.runners.model.Statement
;
import
org.junit.runners.model.Statement
;
...
@@ -32,7 +33,6 @@ import org.springframework.boot.ansi.AnsiOutput;
...
@@ -32,7 +33,6 @@ import org.springframework.boot.ansi.AnsiOutput;
import
org.springframework.boot.ansi.AnsiOutput.Enabled
;
import
org.springframework.boot.ansi.AnsiOutput.Enabled
;
import
static
org
.
hamcrest
.
Matchers
.
allOf
;
import
static
org
.
hamcrest
.
Matchers
.
allOf
;
import
static
org
.
junit
.
Assert
.
assertThat
;
/**
/**
* JUnit {@code @Rule} to capture output from System.out and System.err.
* JUnit {@code @Rule} to capture output from System.out and System.err.
...
@@ -63,7 +63,7 @@ public class OutputCapture implements TestRule {
...
@@ -63,7 +63,7 @@ public class OutputCapture implements TestRule {
try
{
try
{
if
(!
OutputCapture
.
this
.
matchers
.
isEmpty
())
{
if
(!
OutputCapture
.
this
.
matchers
.
isEmpty
())
{
String
output
=
OutputCapture
.
this
.
toString
();
String
output
=
OutputCapture
.
this
.
toString
();
assertThat
(
output
,
allOf
(
OutputCapture
.
this
.
matchers
));
Assert
.
assertThat
(
output
,
allOf
(
OutputCapture
.
this
.
matchers
));
}
}
}
}
finally
{
finally
{
...
...
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