Skip to content

Commit bd57d86

Browse files
imkulwantsbrannen
authored andcommitted
Use StandardCharsets
See gh-29408
1 parent c091bbd commit bd57d86

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/handler/HttpReceivingTransportHandlerTests.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import org.springframework.web.socket.sockjs.transport.session.StubSockJsServiceConfig;
2727
import org.springframework.web.socket.sockjs.transport.session.TestHttpSockJsSession;
2828

29+
import java.nio.charset.StandardCharsets;
30+
2931
import static org.assertj.core.api.Assertions.assertThat;
3032
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
3133
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
@@ -44,18 +46,18 @@ public class HttpReceivingTransportHandlerTests extends AbstractHttpRequestTests
4446

4547
@Test
4648
public void readMessagesXhr() throws Exception {
47-
this.servletRequest.setContent("[\"x\"]".getBytes("UTF-8"));
49+
this.servletRequest.setContent("[\"x\"]".getBytes(StandardCharsets.UTF_8));
4850
handleRequest(new XhrReceivingTransportHandler());
4951

5052
assertThat(this.servletResponse.getStatus()).isEqualTo(204);
5153
}
5254

5355
@Test
5456
public void readMessagesBadContent() throws Exception {
55-
this.servletRequest.setContent("".getBytes("UTF-8"));
57+
this.servletRequest.setContent("".getBytes(StandardCharsets.UTF_8));
5658
handleRequestAndExpectFailure();
5759

58-
this.servletRequest.setContent("[\"x]".getBytes("UTF-8"));
60+
this.servletRequest.setContent("[\"x]".getBytes(StandardCharsets.UTF_8));
5961
handleRequestAndExpectFailure();
6062
}
6163

@@ -69,7 +71,7 @@ public void readMessagesNoSession() throws Exception {
6971
@Test
7072
public void delegateMessageException() throws Exception {
7173
StubSockJsServiceConfig sockJsConfig = new StubSockJsServiceConfig();
72-
this.servletRequest.setContent("[\"x\"]".getBytes("UTF-8"));
74+
this.servletRequest.setContent("[\"x\"]".getBytes(StandardCharsets.UTF_8));
7375

7476
WebSocketHandler wsHandler = mock(WebSocketHandler.class);
7577
TestHttpSockJsSession session = new TestHttpSockJsSession("1", sockJsConfig, wsHandler, null);

0 commit comments

Comments
 (0)