diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java index d467117edc..dc103519a9 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java @@ -27,6 +27,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Locale; import java.util.Map; +import java.util.Properties; import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicReference; @@ -80,6 +81,8 @@ import org.springframework.boot.web.server.WebServerException; import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory; import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactoryTests; import org.springframework.core.io.ByteArrayResource; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.support.PropertiesLoaderUtils; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; @@ -404,13 +407,15 @@ class TomcatServletWebServerFactoryTests extends AbstractServletWebServerFactory } @Test - void defaultLocaleCharsetMappingsAreOverridden() { + void defaultLocaleCharsetMappingsAreOverridden() throws IOException { TomcatServletWebServerFactory factory = getFactory(); this.webServer = factory.getWebServer(); // override defaults, see org.apache.catalina.util.CharsetMapperDefault.properties - assertThat(getCharset(Locale.ENGLISH)).isEqualTo(StandardCharsets.UTF_8); - assertThat(getCharset(Locale.FRENCH)).isEqualTo(StandardCharsets.UTF_8); - assertThat(getCharset(Locale.JAPANESE)).isEqualTo(StandardCharsets.UTF_8); + Properties charsetMapperDefault = PropertiesLoaderUtils + .loadProperties(new ClassPathResource("CharsetMapperDefault.properties", CharsetMapper.class)); + for (String language : charsetMapperDefault.stringPropertyNames()) { + assertThat(getCharset(new Locale(language))).isEqualTo(StandardCharsets.UTF_8); + } } @Test