You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/06/22 13:33:08 UTC

[commons-lang] 01/03: Fix bug in test.

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

commit 64b2f90d20a20faab6e3cdbf6009475562740a87
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jun 22 09:28:58 2020 -0400

    Fix bug in test.
---
 .../apache/commons/lang3/StringUtilsContainsTest.java | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java
index b543bf7..fb1db99 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java
@@ -244,16 +244,21 @@ public class StringUtilsContainsTest  {
             { "\u00DF", "SS" },
         };
 
-        for (final Locale testLocale : locales) {
-            Locale.setDefault(testLocale);
-            for (int j = 0; j < tdata.length; j++) {
-                assertTrue(StringUtils.containsIgnoreCase(tdata[j][0], tdata[j][1]),
+        final Locale defaultLocale = Locale.getDefault();
+        try {
+            for (final Locale testLocale : locales) {
+                Locale.setDefault(testLocale);
+                for (int j = 0; j < tdata.length; j++) {
+                    assertTrue(StringUtils.containsIgnoreCase(tdata[j][0], tdata[j][1]),
                         Locale.getDefault() + ": " + j + " " + tdata[j][0] + " " + tdata[j][1]);
-            }
-            for (int j = 0; j < fdata.length; j++) {
-                assertFalse(StringUtils.containsIgnoreCase(fdata[j][0], fdata[j][1]),
+                }
+                for (int j = 0; j < fdata.length; j++) {
+                    assertFalse(StringUtils.containsIgnoreCase(fdata[j][0], fdata[j][1]),
                         Locale.getDefault() + ": " + j + " " + fdata[j][0] + " " + fdata[j][1]);
+                }
             }
+        } finally {
+            Locale.setDefault(defaultLocale);
         }
     }