Merge branch '3.4.x'

This commit is contained in:
Andy Wilkinson 2025-03-05 20:08:09 +00:00
commit 2f73406dff
2 changed files with 4 additions and 4 deletions

View File

@ -214,7 +214,7 @@ class ThymeleafReactiveAutoConfigurationTests {
@Test @Test
@WithResource(name = "templates/security-dialect.html", @WithResource(name = "templates/security-dialect.html",
content = "<html><body><div sec:authentication=\"name\"></div></body></html>\n") content = "<html><body><div sec:authentication=\"name\"></div></body></html>")
void useSecurityDialect() { void useSecurityDialect() {
this.contextRunner.run((context) -> { this.contextRunner.run((context) -> {
ISpringWebFluxTemplateEngine engine = context.getBean(ISpringWebFluxTemplateEngine.class); ISpringWebFluxTemplateEngine engine = context.getBean(ISpringWebFluxTemplateEngine.class);
@ -225,7 +225,7 @@ class ThymeleafReactiveAutoConfigurationTests {
WebContext attrs = new WebContext(SpringWebFluxWebApplication.buildApplication(null) WebContext attrs = new WebContext(SpringWebFluxWebApplication.buildApplication(null)
.buildExchange(exchange, Locale.US, MediaType.TEXT_HTML, StandardCharsets.UTF_8)); .buildExchange(exchange, Locale.US, MediaType.TEXT_HTML, StandardCharsets.UTF_8));
String result = engine.process("security-dialect", attrs); String result = engine.process("security-dialect", attrs);
assertThat(result).isEqualTo("<html><body><div>alice</div></body></html>" + System.lineSeparator()); assertThat(result).isEqualTo("<html><body><div>alice</div></body></html>");
}); });
} }

View File

@ -239,7 +239,7 @@ class ThymeleafServletAutoConfigurationTests {
@Test @Test
@WithResource(name = "templates/security-dialect.html", @WithResource(name = "templates/security-dialect.html",
content = "<html><body><div sec:authentication=\"name\"></div></body></html>\n") content = "<html><body><div sec:authentication=\"name\"></div></body></html>")
void useSecurityDialect() { void useSecurityDialect() {
this.contextRunner.run((context) -> { this.contextRunner.run((context) -> {
TemplateEngine engine = context.getBean(TemplateEngine.class); TemplateEngine engine = context.getBean(TemplateEngine.class);
@ -251,7 +251,7 @@ class ThymeleafServletAutoConfigurationTests {
SecurityContextHolder SecurityContextHolder
.setContext(new SecurityContextImpl(new TestingAuthenticationToken("alice", "admin"))); .setContext(new SecurityContextImpl(new TestingAuthenticationToken("alice", "admin")));
String result = engine.process("security-dialect", attrs); String result = engine.process("security-dialect", attrs);
assertThat(result).isEqualTo("<html><body><div>alice</div></body></html>" + System.lineSeparator()); assertThat(result).isEqualTo("<html><body><div>alice</div></body></html>");
} }
finally { finally {
SecurityContextHolder.clearContext(); SecurityContextHolder.clearContext();