This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git


The following commit(s) were added to refs/heads/master by this push:
     new d2f8cac96 Use JUnit Pioneer @DefaultLocale to avoid side effects
d2f8cac96 is described below

commit d2f8cac966a729df044ecfa036389658b784a281
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Thu Dec 5 14:57:14 2024 -0500

    Use JUnit Pioneer @DefaultLocale to avoid side effects
---
 .../java/org/apache/commons/lang3/StringUtilsTest.java   | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java 
b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
index 9f954593b..2c2ed1f30 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
@@ -51,6 +51,7 @@ import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
+import org.junitpioneer.jupiter.DefaultLocale;
 import org.junitpioneer.jupiter.ReadsDefaultLocale;
 import org.junitpioneer.jupiter.WritesDefaultLocale;
 
@@ -3102,14 +3103,13 @@ public class StringUtilsTest extends AbstractLangTest {
         assertNotEquals("title", "TITLE".toLowerCase(TURKISH));
         assertEquals("title", "TITLE".toLowerCase(Locale.ROOT));
         assertEquals("title", StringUtils.toRootLowerCase("TITLE"));
-        // Make sure we are not using the default Locale:
-        final Locale defaultLocale = Locale.getDefault();
-        try {
-            Locale.setDefault(TURKISH);
-            assertEquals("title", StringUtils.toRootLowerCase("TITLE"));
-        } finally {
-            Locale.setDefault(defaultLocale);
-        }
+    }
+
+    @Test
+    @DefaultLocale("tr")
+    @ReadsDefaultLocale
+    public void testToRootLowerCaseTurkish() {
+        assertEquals("title", StringUtils.toRootLowerCase("TITLE"));
     }
 
     @Test

Reply via email to