Skip to content

Commit d7b23ed

Browse files
committed
Merge branch '2.6.x' into 2.7.x
Closes gh-30739
2 parents 3682985 + 9162520 commit d7b23ed

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.util.HashMap;
2828
import java.util.Locale;
2929
import java.util.Map;
30+
import java.util.Properties;
3031
import java.util.concurrent.Future;
3132
import java.util.concurrent.atomic.AtomicReference;
3233

@@ -80,6 +81,8 @@
8081
import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory;
8182
import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactoryTests;
8283
import org.springframework.core.io.ByteArrayResource;
84+
import org.springframework.core.io.ClassPathResource;
85+
import org.springframework.core.io.support.PropertiesLoaderUtils;
8386
import org.springframework.http.HttpEntity;
8487
import org.springframework.http.HttpHeaders;
8588
import org.springframework.http.HttpStatus;
@@ -404,13 +407,15 @@ protected TomcatWebServer getTomcatWebServer(Tomcat tomcat) {
404407
}
405408

406409
@Test
407-
void defaultLocaleCharsetMappingsAreOverridden() {
410+
void defaultLocaleCharsetMappingsAreOverridden() throws IOException {
408411
TomcatServletWebServerFactory factory = getFactory();
409412
this.webServer = factory.getWebServer();
410413
// override defaults, see org.apache.catalina.util.CharsetMapperDefault.properties
411-
assertThat(getCharset(Locale.ENGLISH)).isEqualTo(StandardCharsets.UTF_8);
412-
assertThat(getCharset(Locale.FRENCH)).isEqualTo(StandardCharsets.UTF_8);
413-
assertThat(getCharset(Locale.JAPANESE)).isEqualTo(StandardCharsets.UTF_8);
414+
Properties charsetMapperDefault = PropertiesLoaderUtils
415+
.loadProperties(new ClassPathResource("CharsetMapperDefault.properties", CharsetMapper.class));
416+
for (String language : charsetMapperDefault.stringPropertyNames()) {
417+
assertThat(getCharset(new Locale(language))).isEqualTo(StandardCharsets.UTF_8);
418+
}
414419
}
415420

416421
@Test

0 commit comments

Comments
 (0)