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
652561c2
Commit
652561c2
authored
Sep 01, 2020
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Review checkstyle rule to prevent non BDD mockito imports
Closes gh-20902
parent
a341d005
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
Hazelcast4HazelcastHealthIndicatorTests.java
...te/hazelcast/Hazelcast4HazelcastHealthIndicatorTests.java
+2
-2
HazelcastHealthIndicatorTests.java
...boot/actuate/hazelcast/HazelcastHealthIndicatorTests.java
+2
-2
checkstyle.xml
src/checkstyle/checkstyle.xml
+2
-2
No files found.
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast/Hazelcast4HazelcastHealthIndicatorTests.java
View file @
652561c2
...
...
@@ -31,7 +31,7 @@ import org.springframework.core.io.ClassPathResource;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
BDDMockito
.
wh
en
;
import
static
org
.
mockito
.
BDDMockito
.
giv
en
;
import
static
org
.
mockito
.
Mockito
.
mock
;
/**
...
...
@@ -63,7 +63,7 @@ class Hazelcast4HazelcastHealthIndicatorTests {
@Test
void
hazelcastDown
()
{
HazelcastInstance
hazelcast
=
mock
(
HazelcastInstance
.
class
);
when
(
hazelcast
.
executeTransaction
(
any
())).
then
Throw
(
new
HazelcastException
());
given
(
hazelcast
.
executeTransaction
(
any
())).
will
Throw
(
new
HazelcastException
());
Health
health
=
new
HazelcastHealthIndicator
(
hazelcast
).
health
();
assertThat
(
health
.
getStatus
()).
isEqualTo
(
Status
.
DOWN
);
}
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast/HazelcastHealthIndicatorTests.java
View file @
652561c2
...
...
@@ -29,7 +29,7 @@ import org.springframework.core.io.ClassPathResource;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
BDDMockito
.
wh
en
;
import
static
org
.
mockito
.
BDDMockito
.
giv
en
;
import
static
org
.
mockito
.
Mockito
.
mock
;
/**
...
...
@@ -59,7 +59,7 @@ class HazelcastHealthIndicatorTests {
@Test
void
hazelcastDown
()
{
HazelcastInstance
hazelcast
=
mock
(
HazelcastInstance
.
class
);
when
(
hazelcast
.
executeTransaction
(
any
())).
then
Throw
(
new
HazelcastException
());
given
(
hazelcast
.
executeTransaction
(
any
())).
will
Throw
(
new
HazelcastException
());
Health
health
=
new
HazelcastHealthIndicator
(
hazelcast
).
health
();
assertThat
(
health
.
getStatus
()).
isEqualTo
(
Status
.
DOWN
);
}
...
...
src/checkstyle/checkstyle.xml
View file @
652561c2
...
...
@@ -41,9 +41,9 @@
</module>
<module
name=
"com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineJavaCheck"
>
<property
name=
"maximum"
value=
"0"
/>
<property
name=
"format"
value=
"org\.mockito\.
Mockito
\.(when|doThrow|doAnswer)"
/>
<property
name=
"format"
value=
"org\.mockito\.
(Mockito|BDDMockito)
\.(when|doThrow|doAnswer)"
/>
<property
name=
"message"
value=
"Please use BDDMockito imports."
/>
value=
"Please use BDD
-style (given, when, then) using BDD
Mockito imports."
/>
<property
name=
"ignoreComments"
value=
"true"
/>
</module>
<module
name=
"io.spring.javaformat.checkstyle.check.SpringJavadocCheck"
>
...
...
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