apache-commons-lang3/0001-Remove-test-dependency-on-JUnit-Pioneer.patch

312 lines
14 KiB
Diff
Raw Normal View History

2021-03-11 12:26:15 +00:00
From 98753efcb2ff4d531a1eca08ded5c227ae6149b6 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Thu, 11 Mar 2021 13:14:20 +0100
Subject: [PATCH] Remove test dependency on JUnit Pioneer
sed -i '/<groupId>org.junit-pioneer/,/<dependency>/d' pom.xml
sed -i '/^import org.junitpioneer/ d
/@Default\(Locale\|TimeZone\)([^)]*)/ {
h
d
}
/@Test/ {
x
s/\( *\)..*/\1@org.junit.jupiter.api.Disabled("JUnit Pioneer not available")/
/./p
s/.*//
x
}' $(grep org.junitpioneer -rl src/test/java/)
---
pom.xml | 6 ------
.../commons/lang3/StringUtilsContainsTest.java | 3 +--
.../commons/lang3/time/DateFormatUtilsTest.java | 6 ++----
.../apache/commons/lang3/time/DateUtilsTest.java | 11 +++++------
2023-08-11 09:39:46 +00:00
.../lang3/time/DurationFormatUtilsTest.java | 3 +--
2021-03-11 12:26:15 +00:00
.../commons/lang3/time/FastDateFormatTest.java | 14 +++++---------
2023-12-18 12:00:04 +00:00
.../time/FastDateParser_TimeZoneStrategyTest.java | 7 +------
2021-03-11 12:26:15 +00:00
.../commons/lang3/time/FastDatePrinterTest.java | 10 +++-------
2023-12-18 12:00:04 +00:00
8 files changed, 18 insertions(+), 42 deletions(-)
2021-03-11 12:26:15 +00:00
diff --git a/pom.xml b/pom.xml
2023-12-18 12:00:04 +00:00
index 1c62e33..c8b4d1a 100644
2021-03-11 12:26:15 +00:00
--- a/pom.xml
+++ b/pom.xml
2023-12-18 12:00:04 +00:00
@@ -526,12 +526,6 @@
2021-03-11 12:26:15 +00:00
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.junit-pioneer</groupId>
- <artifactId>junit-pioneer</artifactId>
2023-08-11 09:39:46 +00:00
- <version>1.9.1</version>
2021-03-11 12:26:15 +00:00
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java
2023-12-18 12:00:04 +00:00
index 87c5548..a2cb3dc 100644
2021-03-11 12:26:15 +00:00
--- a/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsContainsTest.java
2023-08-11 09:39:46 +00:00
@@ -27,7 +27,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
2021-03-11 12:26:15 +00:00
import java.util.Locale;
import org.junit.jupiter.api.Test;
-import org.junitpioneer.jupiter.DefaultLocale;
/**
* Unit tests {@link org.apache.commons.lang3.StringUtils} - Contains methods
2023-08-11 09:39:46 +00:00
@@ -230,7 +229,7 @@ public class StringUtilsContainsTest extends AbstractLangTest {
2023-12-18 12:00:04 +00:00
assertTrue(StringUtils.containsAnyIgnoreCase("abc", "d", "abc"));
2021-03-11 12:26:15 +00:00
}
- @DefaultLocale(language = "de", country = "DE")
+ @org.junit.jupiter.api.Disabled("JUnit Pioneer not available")
@Test
public void testContainsIgnoreCase_LocaleIndependence() {
final Locale[] locales = { Locale.ENGLISH, new Locale("tr"), Locale.getDefault() };
diff --git a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
2023-08-11 09:39:46 +00:00
index 3e8fd08..17ef99f 100644
2021-03-11 12:26:15 +00:00
--- a/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
2023-08-11 09:39:46 +00:00
@@ -31,8 +31,6 @@ import java.util.TimeZone;
2021-03-11 12:26:15 +00:00
2023-08-11 09:39:46 +00:00
import org.apache.commons.lang3.AbstractLangTest;
2021-03-11 12:26:15 +00:00
import org.junit.jupiter.api.Test;
-import org.junitpioneer.jupiter.DefaultLocale;
-import org.junitpioneer.jupiter.DefaultTimeZone;
/**
* TestCase for DateFormatUtils.
2023-08-11 09:39:46 +00:00
@@ -160,7 +158,7 @@ public class DateFormatUtilsTest extends AbstractLangTest {
assertEquals("20030608221112", DateFormatUtils.format(calendar, "yyyyMMddHHmmss"));
2021-03-11 12:26:15 +00:00
}
- @DefaultTimeZone("UTC")
+ @org.junit.jupiter.api.Disabled("JUnit Pioneer not available")
@Test
public void testLang530() throws ParseException {
final Date d = new Date();
2023-08-11 09:39:46 +00:00
@@ -212,7 +210,7 @@ public class DateFormatUtilsTest extends AbstractLangTest {
2021-03-11 12:26:15 +00:00
}
}
- @DefaultLocale(language = "en")
+ @org.junit.jupiter.api.Disabled("JUnit Pioneer not available")
@Test
public void testSMTP() {
TimeZone timeZone = TimeZone.getTimeZone("GMT-3");
diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
2023-08-11 09:39:46 +00:00
index d3e7abb..47dc56d 100644
2021-03-11 12:26:15 +00:00
--- a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
2023-08-11 09:39:46 +00:00
@@ -41,7 +41,6 @@ import org.junit.jupiter.api.AfterEach;
2021-03-11 12:26:15 +00:00
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junitpioneer.jupiter.DefaultLocale;
/**
2023-08-11 09:39:46 +00:00
* Tests {@link org.apache.commons.lang3.time.DateUtils}.
@@ -806,13 +805,13 @@ public class DateUtilsTest extends AbstractLangTest {
2021-03-11 12:26:15 +00:00
}
2023-08-11 09:39:46 +00:00
/** Parse English date with German Locale. */
2021-03-11 12:26:15 +00:00
- @DefaultLocale(language = "de")
+ @org.junit.jupiter.api.Disabled("JUnit Pioneer not available")
@Test
public void testLANG799_DE_FAIL() {
assertThrows(ParseException.class, () -> DateUtils.parseDate("Wed, 09 Apr 2008 23:55:38 GMT", "EEE, dd MMM yyyy HH:mm:ss zzz"));
}
- @DefaultLocale(language = "de")
+ @org.junit.jupiter.api.Disabled("JUnit Pioneer not available")
@Test
public void testLANG799_DE_OK() throws ParseException {
DateUtils.parseDate("Mi, 09 Apr 2008 23:55:38 GMT", "EEE, dd MMM yyyy HH:mm:ss zzz");
2023-08-11 09:39:46 +00:00
@@ -820,13 +819,13 @@ public class DateUtilsTest extends AbstractLangTest {
2021-03-11 12:26:15 +00:00
}
// Parse German date with English Locale
- @DefaultLocale(language = "en")
+ @org.junit.jupiter.api.Disabled("JUnit Pioneer not available")
@Test
public void testLANG799_EN_FAIL() {
assertThrows(ParseException.class, () -> DateUtils.parseDate("Mi, 09 Apr 2008 23:55:38 GMT", "EEE, dd MMM yyyy HH:mm:ss zzz"));
}
- @DefaultLocale(language = "en")
+ @org.junit.jupiter.api.Disabled("JUnit Pioneer not available")
@Test
public void testLANG799_EN_OK() throws ParseException {
DateUtils.parseDate("Wed, 09 Apr 2008 23:55:38 GMT", "EEE, dd MMM yyyy HH:mm:ss zzz");
2023-08-11 09:39:46 +00:00
@@ -834,7 +833,7 @@ public class DateUtilsTest extends AbstractLangTest {
2021-03-11 12:26:15 +00:00
}
2023-08-11 09:39:46 +00:00
/** Parse German date with English Locale, specifying German Locale override. */
2021-03-11 12:26:15 +00:00
- @DefaultLocale(language = "en")
+ @org.junit.jupiter.api.Disabled("JUnit Pioneer not available")
@Test
public void testLANG799_EN_WITH_DE_LOCALE() throws ParseException {
DateUtils.parseDate("Mi, 09 Apr 2008 23:55:38 GMT", Locale.GERMAN, "EEE, dd MMM yyyy HH:mm:ss zzz");
2023-08-11 09:39:46 +00:00
diff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java
2023-12-18 12:00:04 +00:00
index baedbce..30b67e3 100644
2023-08-11 09:39:46 +00:00
--- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java
2023-12-18 12:00:04 +00:00
@@ -33,7 +33,6 @@ import java.util.TimeZone;
2023-08-11 09:39:46 +00:00
import org.apache.commons.lang3.AbstractLangTest;
import org.junit.jupiter.api.Test;
-import org.junitpioneer.jupiter.DefaultTimeZone;
/**
* Tests {@link DurationFormatUtils}.
2023-12-18 12:00:04 +00:00
@@ -157,7 +156,6 @@ public class DurationFormatUtilsTest extends AbstractLangTest {
2023-08-11 09:39:46 +00:00
/** Attempting to test edge cases in DurationFormatUtils.formatPeriod. */
@Test
- @DefaultTimeZone(TimeZones.GMT_ID)
public void testEdgeDurations() {
// This test case must use a time zone without DST
TimeZone.setDefault(FastTimeZone.getGmtTimeZone());
2023-12-18 12:00:04 +00:00
@@ -249,6 +247,7 @@ public class DurationFormatUtilsTest extends AbstractLangTest {
2023-08-11 09:39:46 +00:00
}
+ @org.junit.jupiter.api.Disabled("JUnit Pioneer not available")
@Test
2023-12-18 12:00:04 +00:00
public void testEmptyOptionals() {
assertEquals(
2021-03-11 12:26:15 +00:00
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java
2023-12-18 12:00:04 +00:00
index ffaf5a0..51530e0 100644
2021-03-11 12:26:15 +00:00
--- a/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java
2023-08-11 09:39:46 +00:00
@@ -40,8 +40,6 @@ import java.util.concurrent.atomic.AtomicLongArray;
2021-03-11 12:26:15 +00:00
2023-08-11 09:39:46 +00:00
import org.apache.commons.lang3.AbstractLangTest;
2021-03-11 12:26:15 +00:00
import org.junit.jupiter.api.Test;
-import org.junitpioneer.jupiter.DefaultLocale;
-import org.junitpioneer.jupiter.DefaultTimeZone;
/**
* Unit tests {@link org.apache.commons.lang3.time.FastDateFormat}.
2023-08-11 09:39:46 +00:00
@@ -99,7 +97,7 @@ public class FastDateFormatTest extends AbstractLangTest {
2021-03-11 12:26:15 +00:00
return totalElapsed;
}
- @DefaultLocale(language = "en", country = "US")
+ @org.junit.jupiter.api.Disabled("JUnit Pioneer not available")
@Test
public void test_changeDefault_Locale_DateInstance() {
final FastDateFormat format1 = FastDateFormat.getDateInstance(FastDateFormat.FULL, Locale.GERMANY);
2023-08-11 09:39:46 +00:00
@@ -114,7 +112,7 @@ public class FastDateFormatTest extends AbstractLangTest {
2021-03-11 12:26:15 +00:00
assertNotSame(format2, format3);
}
- @DefaultLocale(language = "en", country = "US")
+ @org.junit.jupiter.api.Disabled("JUnit Pioneer not available")
@Test
public void test_changeDefault_Locale_DateTimeInstance() {
final FastDateFormat format1 = FastDateFormat.getDateTimeInstance(FastDateFormat.FULL, FastDateFormat.FULL, Locale.GERMANY);
2023-08-11 09:39:46 +00:00
@@ -154,7 +152,7 @@ public class FastDateFormatTest extends AbstractLangTest {
2021-03-11 12:26:15 +00:00
assertEquals(TimeZone.getDefault(), format2.getTimeZone());
}
- @DefaultLocale(language = "en", country = "US")
+ @org.junit.jupiter.api.Disabled("JUnit Pioneer not available")
@Test
public void test_getInstance_String_Locale() {
final FastDateFormat format1 = FastDateFormat.getInstance("MM/DD/yyyy", Locale.GERMANY);
2023-08-11 09:39:46 +00:00
@@ -166,8 +164,7 @@ public class FastDateFormatTest extends AbstractLangTest {
2021-03-11 12:26:15 +00:00
assertEquals(Locale.GERMANY, format1.getLocale());
}
- @DefaultLocale(language = "en", country = "US")
- @DefaultTimeZone("America/New_York")
+ @org.junit.jupiter.api.Disabled("JUnit Pioneer not available")
@Test
public void test_getInstance_String_TimeZone() {
2023-08-11 09:39:46 +00:00
@@ -187,8 +184,7 @@ public class FastDateFormatTest extends AbstractLangTest {
2021-03-11 12:26:15 +00:00
assertNotSame(format4, format6);
}
- @DefaultLocale(language = "en", country = "US")
- @DefaultTimeZone("America/New_York")
+ @org.junit.jupiter.api.Disabled("JUnit Pioneer not available")
@Test
public void test_getInstance_String_TimeZone_Locale() {
final FastDateFormat format1 = FastDateFormat.getInstance("MM/DD/yyyy",
2023-12-18 12:00:04 +00:00
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
index c46498c..9b1827b 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
@@ -40,13 +40,7 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
-import org.junitpioneer.jupiter.DefaultLocale;
-import org.junitpioneer.jupiter.DefaultTimeZone;
-import org.junitpioneer.jupiter.ReadsDefaultLocale;
-import org.junitpioneer.jupiter.ReadsDefaultTimeZone;
-/* Make test reproducible */ @DefaultLocale(language = "en")
-/* Make test reproducible */ @DefaultTimeZone(TimeZones.GMT_ID)
/* Make test reproducible */ @ReadsDefaultLocale
/* Make test reproducible */ @ReadsDefaultTimeZone
public class FastDateParser_TimeZoneStrategyTest extends AbstractLangTest {
@@ -68,6 +62,7 @@ public class FastDateParser_TimeZoneStrategyTest extends AbstractLangTest {
return ArraySorter.sort(Locale.getAvailableLocales(), Comparator.comparing(Locale::toString));
}
+@org.junit.jupiter.api.Disabled("JUnit Pioneer not available")
@Test
public void testLang1219() throws ParseException {
final FastDateParser parser = new FastDateParser("dd.MM.yyyy HH:mm:ss z", TimeZone.getDefault(), Locale.GERMAN);
2021-03-11 12:26:15 +00:00
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java
2023-12-18 12:00:04 +00:00
index 8da22d4..73944c6 100644
2021-03-11 12:26:15 +00:00
--- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java
2023-08-11 09:39:46 +00:00
@@ -33,8 +33,6 @@ import java.util.TimeZone;
import org.apache.commons.lang3.AbstractLangTest;
2021-03-11 12:26:15 +00:00
import org.apache.commons.lang3.SerializationUtils;
import org.junit.jupiter.api.Test;
-import org.junitpioneer.jupiter.DefaultLocale;
-import org.junitpioneer.jupiter.DefaultTimeZone;
/**
* Unit tests {@link org.apache.commons.lang3.time.FastDatePrinter}.
2023-08-11 09:39:46 +00:00
@@ -166,8 +164,7 @@ public class FastDatePrinterTest extends AbstractLangTest {
2021-03-11 12:26:15 +00:00
assertNotEquals(printer1, new Object());
}
- @DefaultLocale(language = "en", country = "US")
- @DefaultTimeZone("America/New_York")
+ @org.junit.jupiter.api.Disabled("JUnit Pioneer not available")
@Test
public void testFormat() {
final GregorianCalendar cal1 = new GregorianCalendar(2003, 0, 10, 15, 33, 20);
2023-08-11 09:39:46 +00:00
@@ -407,7 +404,7 @@ public class FastDatePrinterTest extends AbstractLangTest {
2021-03-11 12:26:15 +00:00
assertEquals(expected, format.format(epoch, sb).toString());
}
- @DefaultTimeZone("UTC")
+ @org.junit.jupiter.api.Disabled("JUnit Pioneer not available")
@Test
public void testTimeZoneAsZ() {
final Calendar c = Calendar.getInstance(FastTimeZone.getGmtTimeZone());
2023-08-11 09:39:46 +00:00
@@ -433,8 +430,7 @@ public class FastDatePrinterTest extends AbstractLangTest {
2021-03-11 12:26:15 +00:00
assertTrue(printer.toString().startsWith("FastDate"));
}
- @DefaultLocale(language = "en", country = "US")
- @DefaultTimeZone("America/New_York")
+ @org.junit.jupiter.api.Disabled("JUnit Pioneer not available")
@Test
public void testWeekYear() {
final GregorianCalendar cal = new GregorianCalendar(2020, 12, 31, 0, 0, 0);
--
2023-12-18 12:00:04 +00:00
2.43.0
2021-03-11 12:26:15 +00:00