diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast/Hazelcast4HazelcastHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast/Hazelcast4HazelcastHealthIndicatorTests.java
index a6c587c1e5d..f6d3076c0f1 100644
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast/Hazelcast4HazelcastHealthIndicatorTests.java
+++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast/Hazelcast4HazelcastHealthIndicatorTests.java
@@ -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.when;
+import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
/**
@@ -63,7 +63,7 @@ class Hazelcast4HazelcastHealthIndicatorTests {
@Test
void hazelcastDown() {
HazelcastInstance hazelcast = mock(HazelcastInstance.class);
- when(hazelcast.executeTransaction(any())).thenThrow(new HazelcastException());
+ given(hazelcast.executeTransaction(any())).willThrow(new HazelcastException());
Health health = new HazelcastHealthIndicator(hazelcast).health();
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
}
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast/HazelcastHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast/HazelcastHealthIndicatorTests.java
index 92213328016..ad911800527 100644
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast/HazelcastHealthIndicatorTests.java
+++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast/HazelcastHealthIndicatorTests.java
@@ -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.when;
+import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
/**
@@ -59,7 +59,7 @@ class HazelcastHealthIndicatorTests {
@Test
void hazelcastDown() {
HazelcastInstance hazelcast = mock(HazelcastInstance.class);
- when(hazelcast.executeTransaction(any())).thenThrow(new HazelcastException());
+ given(hazelcast.executeTransaction(any())).willThrow(new HazelcastException());
Health health = new HazelcastHealthIndicator(hazelcast).health();
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
}
diff --git a/src/checkstyle/checkstyle.xml b/src/checkstyle/checkstyle.xml
index d3d713cf8bf..23dad190e39 100644
--- a/src/checkstyle/checkstyle.xml
+++ b/src/checkstyle/checkstyle.xml
@@ -41,9 +41,9 @@
-
+
+ value="Please use BDD-style (given, when, then) using BDDMockito imports." />