Skip to content

Commit b48d94b

Browse files
committed
Use JUnit Pioneer to avoid side effects
1 parent 3cf949a commit b48d94b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828

2929
import org.junit.jupiter.api.Test;
3030
import org.junitpioneer.jupiter.DefaultLocale;
31+
import org.junitpioneer.jupiter.ReadsDefaultLocale;
32+
import org.junitpioneer.jupiter.WritesDefaultLocale;
3133

3234
/**
3335
* Tests {@link StringUtils} - Contains methods
@@ -230,8 +232,10 @@ public void testContainsAnyIgnoreCase_StringStringArray() {
230232
assertTrue(StringUtils.containsAnyIgnoreCase("abc", "d", "abc"));
231233
}
232234

233-
@DefaultLocale(language = "de", country = "DE")
234235
@Test
236+
@DefaultLocale(language = "de", country = "DE")
237+
@ReadsDefaultLocale
238+
@WritesDefaultLocale
235239
public void testContainsIgnoreCase_LocaleIndependence() {
236240
final Locale[] locales = { Locale.ENGLISH, new Locale("tr"), Locale.getDefault() };
237241

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
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.ReadsDefaultLocale;
55+
import org.junitpioneer.jupiter.WritesDefaultLocale;
5456

5557
/**
5658
* Tests for methods of {@link StringUtils}
@@ -3089,6 +3091,8 @@ public void testToEncodedString() {
30893091
}
30903092

30913093
@Test
3094+
@ReadsDefaultLocale
3095+
@WritesDefaultLocale
30923096
public void testToRootLowerCase() {
30933097
assertNull(StringUtils.toRootLowerCase(null));
30943098
assertEquals("a", StringUtils.toRootLowerCase("A"));
@@ -3109,6 +3113,8 @@ public void testToRootLowerCase() {
31093113
}
31103114

31113115
@Test
3116+
@ReadsDefaultLocale
3117+
@WritesDefaultLocale
31123118
public void testToRootUpperCase() {
31133119
assertNull(StringUtils.toRootUpperCase(null));
31143120
assertEquals("A", StringUtils.toRootUpperCase("a"));

0 commit comments

Comments
 (0)