Skip to content

Commit 407ae3b

Browse files
terminuxsnicoll
authored andcommitted
Validate overrides against CharsetMapperDefault.properties
See gh-30692
1 parent 2c30d66 commit 407ae3b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 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

@@ -405,13 +406,15 @@ protected TomcatWebServer getTomcatWebServer(Tomcat tomcat) {
405406
}
406407

407408
@Test
408-
void defaultLocaleCharsetMappingsAreOverridden() {
409+
void defaultLocaleCharsetMappingsAreOverridden() throws IOException {
409410
TomcatServletWebServerFactory factory = getFactory();
410411
this.webServer = factory.getWebServer();
411412
// override defaults, see org.apache.catalina.util.CharsetMapperDefault.properties
412-
assertThat(getCharset(Locale.ENGLISH)).isEqualTo(StandardCharsets.UTF_8);
413-
assertThat(getCharset(Locale.FRENCH)).isEqualTo(StandardCharsets.UTF_8);
414-
assertThat(getCharset(Locale.JAPANESE)).isEqualTo(StandardCharsets.UTF_8);
413+
Properties charsetMapperDefault = new Properties();
414+
charsetMapperDefault.load(CharsetMapper.class.getResourceAsStream("CharsetMapperDefault.properties"));
415+
for (String language : charsetMapperDefault.stringPropertyNames()) {
416+
assertThat(getCharset(new Locale(language))).isEqualTo(StandardCharsets.UTF_8);
417+
}
415418
}
416419

417420
@Test

0 commit comments

Comments
 (0)