Relax test that used to rely on localized message

This reverts commit 93206c3f6e and updates
the related test to only rely on the fact the compiler fails. Relying
on a message will not work and the status code can be implementation
independent according to its javadoc.

Closes gh-31536
This commit is contained in:
Stéphane Nicoll
2023-11-01 16:23:01 +01:00
parent a5841fede5
commit 1d38d649fa
2 changed files with 31 additions and 58 deletions

View File

@@ -19,7 +19,6 @@ 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;
@@ -171,9 +170,9 @@ class TestCompilerTests {
}
""");
assertThatExceptionOfType(CompilationException.class).isThrownBy(
() -> TestCompiler.forSystem().failOnWarning().withLocale(Locale.ENGLISH)
.withSources(SourceFile.of(HELLO_DEPRECATED), main).compile(compiled -> {
})).withMessageContaining("warnings found and -Werror specified");
() -> TestCompiler.forSystem().failOnWarning().withSources(
SourceFile.of(HELLO_DEPRECATED), main).compile(compiled -> {
}));
}
@Test