Add support for custom locale to render compiler messages

Closes gh-31408
This commit is contained in:
Stéphane Nicoll
2023-10-11 08:53:51 +02:00
parent ae88bbaac3
commit 93206c3f6e
2 changed files with 57 additions and 30 deletions

View File

@@ -19,6 +19,7 @@ package org.springframework.core.test.tools;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.function.Supplier;
@@ -170,8 +171,8 @@ class TestCompilerTests {
}
""");
assertThatExceptionOfType(CompilationException.class).isThrownBy(
() -> TestCompiler.forSystem().failOnWarning().withSources(
SourceFile.of(HELLO_DEPRECATED), main).compile(compiled -> {
() -> TestCompiler.forSystem().failOnWarning().withLocale(Locale.ENGLISH)
.withSources(SourceFile.of(HELLO_DEPRECATED), main).compile(compiled -> {
})).withMessageContaining("warnings found and -Werror specified");
}