Skip to content

Commit d8a0509

Browse files
committed
Fix checkstyle BDD Mockito violations
See gh-24337
1 parent 837fc83 commit d8a0509

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast/HazelcastHealthIndicatorTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
import static org.assertj.core.api.Assertions.assertThat;
2929
import static org.mockito.ArgumentMatchers.any;
30-
import static org.mockito.BDDMockito.when;
30+
import static org.mockito.BDDMockito.given;
3131
import static org.mockito.Mockito.mock;
3232

3333
/**
@@ -43,10 +43,10 @@ class HazelcastHealthIndicatorTests {
4343
@Test
4444
void hazelcastUp() {
4545
Endpoint endpoint = mock(Endpoint.class);
46-
when(this.hazelcast.getName()).thenReturn("hz0-instance");
47-
when(this.hazelcast.getLocalEndpoint()).thenReturn(endpoint);
48-
when(endpoint.getUuid()).thenReturn("7581bb2f-879f-413f-b574-0071d7519eb0");
49-
when(this.hazelcast.executeTransaction(any())).thenAnswer((invocation) -> {
46+
given(this.hazelcast.getName()).willReturn("hz0-instance");
47+
given(this.hazelcast.getLocalEndpoint()).willReturn(endpoint);
48+
given(endpoint.getUuid()).willReturn("7581bb2f-879f-413f-b574-0071d7519eb0");
49+
given(this.hazelcast.executeTransaction(any())).willAnswer((invocation) -> {
5050
TransactionalTask<?> task = invocation.getArgument(0);
5151
return task.execute(null);
5252
});
@@ -58,7 +58,7 @@ void hazelcastUp() {
5858

5959
@Test
6060
void hazelcastDown() {
61-
when(this.hazelcast.executeTransaction(any())).thenThrow(new HazelcastException());
61+
given(this.hazelcast.executeTransaction(any())).willReturn(new HazelcastException());
6262
Health health = new HazelcastHealthIndicator(this.hazelcast).health();
6363
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
6464
}

0 commit comments

Comments
 (0)