Skip to content

Commit 2f106fb

Browse files
committed
Polishing web socket test to use BDD Mockito
1 parent bc81fa5 commit 2f106fb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

spring-websocket/src/test/java/org/springframework/web/socket/server/support/WebSocketHttpRequestHandlerTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import static org.assertj.core.api.Assertions.assertThat;
3636
import static org.assertj.core.api.Assertions.assertThatThrownBy;
3737
import static org.mockito.ArgumentMatchers.any;
38-
import static org.mockito.BDDMockito.when;
38+
import static org.mockito.BDDMockito.given;
3939
import static org.mockito.Mockito.mock;
4040
import static org.mockito.Mockito.verify;
4141
import static org.mockito.Mockito.verifyNoMoreInteractions;
@@ -70,8 +70,8 @@ public void failure() {
7070
TestInterceptor interceptor = new TestInterceptor(true);
7171
this.requestHandler.setHandshakeInterceptors(Collections.singletonList(interceptor));
7272

73-
when(this.handshakeHandler.doHandshake(any(), any(), any(), any()))
74-
.thenThrow(new IllegalStateException("bad state"));
73+
given(this.handshakeHandler.doHandshake(any(), any(), any(), any()))
74+
.willThrow(new IllegalStateException("bad state"));
7575

7676
assertThatThrownBy(() -> this.requestHandler.handleRequest(new MockHttpServletRequest(), this.response))
7777
.isInstanceOf(HandshakeFailureException.class)

0 commit comments

Comments
 (0)