Use text block where feasible

See gh-31916
This commit is contained in:
Yanming Zhou
2023-12-28 15:04:50 +08:00
committed by Stéphane Nicoll
parent 9d31537ae5
commit a35384fd57
9 changed files with 93 additions and 41 deletions

View File

@@ -114,8 +114,11 @@ public class ComplexWebApplicationContext extends StaticWebApplicationContext {
pvs = new MutablePropertyValues();
pvs.add(
"mappings", "/head.do=headController\n" +
"body.do=bodyController\n/noview*=noviewController\n/noview/simple*=noviewController");
"mappings", """
/head.do=headController
body.do=bodyController
/noview*=noviewController
/noview/simple*=noviewController""");
pvs.add("order", "1");
registerSingleton("handlerMapping", SimpleUrlHandlerMapping.class, pvs);

View File

@@ -109,11 +109,13 @@ class SseServerResponseTests {
ModelAndView mav = response.writeTo(this.mockRequest, this.mockResponse, context);
assertThat(mav).isNull();
String expected = "data:{\n" +
"data: \"name\" : \"John Doe\",\n" +
"data: \"age\" : 42\n" +
"data:}\n" +
"\n";
String expected = """
data:{
data: "name" : "John Doe",
data: "age" : 42
data:}
""";
assertThat(this.mockResponse.getContentAsString()).isEqualTo(expected);
}