Merge branch '5.3.x'
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -91,6 +91,7 @@ import org.springframework.web.testfixture.servlet.MockServletContext;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.assertj.core.api.InstanceOfAssertFactories.BOOLEAN;
|
||||
|
||||
/**
|
||||
* Test fixture for {@link MessageBrokerBeanDefinitionParser}.
|
||||
@@ -128,7 +129,7 @@ public class MessageBrokerBeanDefinitionParserTests {
|
||||
|
||||
WebSocketSession session = new TestWebSocketSession("id");
|
||||
wsHttpRequestHandler.getWebSocketHandler().afterConnectionEstablished(session);
|
||||
assertThat(session.getAttributes().get("decorated")).isEqualTo(true);
|
||||
assertThat(session.getAttributes().get("decorated")).asInstanceOf(BOOLEAN).isTrue();
|
||||
|
||||
WebSocketHandler wsHandler = wsHttpRequestHandler.getWebSocketHandler();
|
||||
assertThat(wsHandler).isInstanceOf(ExceptionWebSocketHandlerDecorator.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -60,6 +60,7 @@ import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;
|
||||
import org.springframework.web.socket.server.support.WebSocketHttpRequestHandler;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.InstanceOfAssertFactories.BOOLEAN;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
@@ -190,7 +191,7 @@ class WebSocketMessageBrokerConfigurationSupportTests {
|
||||
|
||||
WebSocketSession session = new TestWebSocketSession("id");
|
||||
handler.afterConnectionEstablished(session);
|
||||
assertThat(session.getAttributes().get("decorated")).isEqualTo(true);
|
||||
assertThat(session.getAttributes().get("decorated")).asInstanceOf(BOOLEAN).isTrue();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -119,7 +119,7 @@ public class ClientSockJsSessionTests {
|
||||
public void handleFrameMessageWithBadData() throws Exception {
|
||||
this.session.handleFrame(SockJsFrame.openFrame().getContent());
|
||||
this.session.handleFrame("a['bad data");
|
||||
assertThat(this.session.isOpen()).isEqualTo(false);
|
||||
assertThat(this.session.isOpen()).isFalse();
|
||||
assertThat(this.session.disconnectStatus).isEqualTo(CloseStatus.BAD_DATA);
|
||||
verify(this.handler).afterConnectionEstablished(this.session);
|
||||
verifyNoMoreInteractions(this.handler);
|
||||
@@ -133,7 +133,7 @@ public class ClientSockJsSessionTests {
|
||||
willThrow(new IllegalStateException("Fake error")).given(this.handler)
|
||||
.handleMessage(this.session, new TextMessage("bar"));
|
||||
this.session.handleFrame(SockJsFrame.messageFrame(CODEC, "foo", "bar").getContent());
|
||||
assertThat(this.session.isOpen()).isEqualTo(true);
|
||||
assertThat(this.session.isOpen()).isTrue();
|
||||
verify(this.handler).afterConnectionEstablished(this.session);
|
||||
verify(this.handler).handleMessage(this.session, new TextMessage("foo"));
|
||||
verify(this.handler).handleMessage(this.session, new TextMessage("bar"));
|
||||
@@ -144,7 +144,7 @@ public class ClientSockJsSessionTests {
|
||||
public void handleFrameClose() throws Exception {
|
||||
this.session.handleFrame(SockJsFrame.openFrame().getContent());
|
||||
this.session.handleFrame(SockJsFrame.closeFrame(1007, "").getContent());
|
||||
assertThat(this.session.isOpen()).isEqualTo(false);
|
||||
assertThat(this.session.isOpen()).isFalse();
|
||||
assertThat(this.session.disconnectStatus).isEqualTo(new CloseStatus(1007, ""));
|
||||
verify(this.handler).afterConnectionEstablished(this.session);
|
||||
verifyNoMoreInteractions(this.handler);
|
||||
@@ -162,7 +162,7 @@ public class ClientSockJsSessionTests {
|
||||
public void afterTransportClosed() throws Exception {
|
||||
this.session.handleFrame(SockJsFrame.openFrame().getContent());
|
||||
this.session.afterTransportClosed(CloseStatus.SERVER_ERROR);
|
||||
assertThat(this.session.isOpen()).isEqualTo(false);
|
||||
assertThat(this.session.isOpen()).isFalse();
|
||||
verify(this.handler).afterConnectionEstablished(this.session);
|
||||
verify(this.handler).afterConnectionClosed(this.session, CloseStatus.SERVER_ERROR);
|
||||
verifyNoMoreInteractions(this.handler);
|
||||
@@ -172,7 +172,7 @@ public class ClientSockJsSessionTests {
|
||||
public void close() throws Exception {
|
||||
this.session.handleFrame(SockJsFrame.openFrame().getContent());
|
||||
this.session.close();
|
||||
assertThat(this.session.isOpen()).isEqualTo(false);
|
||||
assertThat(this.session.isOpen()).isFalse();
|
||||
assertThat(this.session.disconnectStatus).isEqualTo(CloseStatus.NORMAL);
|
||||
verify(this.handler).afterConnectionEstablished(this.session);
|
||||
verifyNoMoreInteractions(this.handler);
|
||||
|
||||
Reference in New Issue
Block a user