Skip to content

Commit d2f8cac

Browse files
committed
Use JUnit Pioneer @DefaultLocale to avoid side effects
1 parent 2e3d628 commit d2f8cac

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/test/java/org/apache/commons/lang3/StringUtilsTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import org.junit.jupiter.api.Test;
5252
import org.junit.jupiter.params.ParameterizedTest;
5353
import org.junit.jupiter.params.provider.ValueSource;
54+
import org.junitpioneer.jupiter.DefaultLocale;
5455
import org.junitpioneer.jupiter.ReadsDefaultLocale;
5556
import org.junitpioneer.jupiter.WritesDefaultLocale;
5657

@@ -3102,14 +3103,13 @@ public void testToRootLowerCase() {
31023103
assertNotEquals("title", "TITLE".toLowerCase(TURKISH));
31033104
assertEquals("title", "TITLE".toLowerCase(Locale.ROOT));
31043105
assertEquals("title", StringUtils.toRootLowerCase("TITLE"));
3105-
// Make sure we are not using the default Locale:
3106-
final Locale defaultLocale = Locale.getDefault();
3107-
try {
3108-
Locale.setDefault(TURKISH);
3109-
assertEquals("title", StringUtils.toRootLowerCase("TITLE"));
3110-
} finally {
3111-
Locale.setDefault(defaultLocale);
3112-
}
3106+
}
3107+
3108+
@Test
3109+
@DefaultLocale("tr")
3110+
@ReadsDefaultLocale
3111+
public void testToRootLowerCaseTurkish() {
3112+
assertEquals("title", StringUtils.toRootLowerCase("TITLE"));
31133113
}
31143114

31153115
@Test

0 commit comments

Comments
 (0)