File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 27
27
28
28
import static org .assertj .core .api .Assertions .assertThat ;
29
29
import static org .mockito .ArgumentMatchers .any ;
30
- import static org .mockito .BDDMockito .when ;
30
+ import static org .mockito .BDDMockito .given ;
31
31
import static org .mockito .Mockito .mock ;
32
32
33
33
/**
@@ -43,10 +43,10 @@ class HazelcastHealthIndicatorTests {
43
43
@ Test
44
44
void hazelcastUp () {
45
45
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 ) -> {
50
50
TransactionalTask <?> task = invocation .getArgument (0 );
51
51
return task .execute (null );
52
52
});
@@ -58,7 +58,7 @@ void hazelcastUp() {
58
58
59
59
@ Test
60
60
void hazelcastDown () {
61
- when (this .hazelcast .executeTransaction (any ())).thenThrow (new HazelcastException ());
61
+ given (this .hazelcast .executeTransaction (any ())).willReturn (new HazelcastException ());
62
62
Health health = new HazelcastHealthIndicator (this .hazelcast ).health ();
63
63
assertThat (health .getStatus ()).isEqualTo (Status .DOWN );
64
64
}
You can’t perform that action at this time.
0 commit comments