26
26
import org .springframework .web .socket .sockjs .transport .session .StubSockJsServiceConfig ;
27
27
import org .springframework .web .socket .sockjs .transport .session .TestHttpSockJsSession ;
28
28
29
+ import java .nio .charset .StandardCharsets ;
30
+
29
31
import static org .assertj .core .api .Assertions .assertThat ;
30
32
import static org .assertj .core .api .Assertions .assertThatExceptionOfType ;
31
33
import static org .assertj .core .api .Assertions .assertThatIllegalArgumentException ;
@@ -44,18 +46,18 @@ public class HttpReceivingTransportHandlerTests extends AbstractHttpRequestTests
44
46
45
47
@ Test
46
48
public void readMessagesXhr () throws Exception {
47
- this .servletRequest .setContent ("[\" x\" ]" .getBytes ("UTF-8" ));
49
+ this .servletRequest .setContent ("[\" x\" ]" .getBytes (StandardCharsets . UTF_8 ));
48
50
handleRequest (new XhrReceivingTransportHandler ());
49
51
50
52
assertThat (this .servletResponse .getStatus ()).isEqualTo (204 );
51
53
}
52
54
53
55
@ Test
54
56
public void readMessagesBadContent () throws Exception {
55
- this .servletRequest .setContent ("" .getBytes ("UTF-8" ));
57
+ this .servletRequest .setContent ("" .getBytes (StandardCharsets . UTF_8 ));
56
58
handleRequestAndExpectFailure ();
57
59
58
- this .servletRequest .setContent ("[\" x]" .getBytes ("UTF-8" ));
60
+ this .servletRequest .setContent ("[\" x]" .getBytes (StandardCharsets . UTF_8 ));
59
61
handleRequestAndExpectFailure ();
60
62
}
61
63
@@ -69,7 +71,7 @@ public void readMessagesNoSession() throws Exception {
69
71
@ Test
70
72
public void delegateMessageException () throws Exception {
71
73
StubSockJsServiceConfig sockJsConfig = new StubSockJsServiceConfig ();
72
- this .servletRequest .setContent ("[\" x\" ]" .getBytes ("UTF-8" ));
74
+ this .servletRequest .setContent ("[\" x\" ]" .getBytes (StandardCharsets . UTF_8 ));
73
75
74
76
WebSocketHandler wsHandler = mock (WebSocketHandler .class );
75
77
TestHttpSockJsSession session = new TestHttpSockJsSession ("1" , sockJsConfig , wsHandler , null );
0 commit comments