Skip to content

Commit 5245327

Browse files
imkulwantsbrannen
authored andcommitted
Fix tests and checkstyle violations
See gh-29408
1 parent 20d0bec commit 5245327

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

spring-websocket/src/main/java/org/springframework/web/socket/sockjs/support/AbstractSockJsService.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -618,17 +618,17 @@ private class IframeHandler implements SockJsRequestHandler {
618618
<!DOCTYPE html>
619619
<html>
620620
<head>
621-
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
622-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
623-
<script>
624-
document.domain = document.domain;
625-
_sockjs_onload = function(){SockJS.bootstrap_iframe();};
626-
</script>
627-
<script src="%s"></script>
621+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
622+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
623+
<script>
624+
document.domain = document.domain;
625+
_sockjs_onload = function(){SockJS.bootstrap_iframe();};
626+
</script>
627+
<script src="%s"></script>
628628
</head>
629629
<body>
630-
<h2>Don't panic!</h2>
631-
<p>This is a SockJS hidden iframe. It's used for cross domain magic.</p>
630+
<h2>Don't panic!</h2>
631+
<p>This is a SockJS hidden iframe. It's used for cross domain magic.</p>
632632
</body>
633633
</html>""";
634634

spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/HtmlFileTransportHandler.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ public class HtmlFileTransportHandler extends AbstractHttpSendingTransportHandle
6161
static {
6262
StringBuilder sb = new StringBuilder(
6363
"""
64-
<!doctype html>
64+
<!DOCTYPE html>
6565
<html><head>
66-
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
67-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
66+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
67+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6868
</head><body><h2>Don't panic!</h2>
69-
<script>
70-
document.domain = document.domain;
71-
var c = parent.%s;
72-
c.start();
73-
function p(d) {c.message(d);};
74-
window.onload = function() {c.stop();};
75-
</script>"""
69+
<script>
70+
document.domain = document.domain;
71+
var c = parent.%s;
72+
c.start();
73+
function p(d) {c.message(d);};
74+
window.onload = function() {c.stop();};
75+
</script>"""
7676
);
7777

7878
while (sb.length() < MINIMUM_PARTIAL_HTML_CONTENT_LENGTH) {

spring-websocket/src/test/java/org/springframework/web/socket/sockjs/support/SockJsServiceTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,14 @@ public void handleIframeRequest() throws IOException {
238238

239239
assertThat(this.servletResponse.getContentType()).isEqualTo("text/html;charset=UTF-8");
240240
assertThat(this.servletResponse.getContentAsString().startsWith("<!DOCTYPE html>\n")).isTrue();
241-
assertThat(this.servletResponse.getContentLength()).isEqualTo(490);
241+
assertThat(this.servletResponse.getContentLength()).isEqualTo(479);
242242
assertThat(this.response.getHeaders().getCacheControl()).isEqualTo("no-store, no-cache, must-revalidate, max-age=0");
243-
assertThat(this.response.getHeaders().getETag()).isEqualTo("\"0096cbd37f2a5218c33bb0826a7c74cbf\"");
243+
assertThat(this.response.getHeaders().getETag()).isEqualTo("\"096aaf2482e2a85effc0ab65a61993ae0\"");
244244
}
245245

246246
@Test
247247
public void handleIframeRequestNotModified() {
248-
this.servletRequest.addHeader("If-None-Match", "\"0096cbd37f2a5218c33bb0826a7c74cbf\"");
248+
this.servletRequest.addHeader("If-None-Match", "\"096aaf2482e2a85effc0ab65a61993ae0\"");
249249
resetResponseAndHandleRequest("GET", "/echo/iframe.html", HttpStatus.NOT_MODIFIED);
250250
}
251251

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.web.socket.sockjs.transport.handler;
1818

19+
import java.nio.charset.StandardCharsets;
20+
1921
import org.junit.jupiter.api.Test;
2022

2123
import org.springframework.web.socket.AbstractHttpRequestTests;
@@ -26,8 +28,6 @@
2628
import org.springframework.web.socket.sockjs.transport.session.StubSockJsServiceConfig;
2729
import org.springframework.web.socket.sockjs.transport.session.TestHttpSockJsSession;
2830

29-
import java.nio.charset.StandardCharsets;
30-
3131
import static org.assertj.core.api.Assertions.assertThat;
3232
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
3333
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;

0 commit comments

Comments
 (0)