This is an automated email from the ASF dual-hosted git repository. garydgregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-cli.git
commit 4eed3816eb91ebfc4f887f76f0dfd43563edaf32 Author: Gary Gregory <[email protected]> AuthorDate: Sat Jun 27 12:03:49 2026 +0000 Add ConverterTests.testDateLocaleDe() --- src/test/java/org/apache/commons/cli/ConverterTests.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/apache/commons/cli/ConverterTests.java b/src/test/java/org/apache/commons/cli/ConverterTests.java index 8691d075..278b9d55 100644 --- a/src/test/java/org/apache/commons/cli/ConverterTests.java +++ b/src/test/java/org/apache/commons/cli/ConverterTests.java @@ -26,12 +26,14 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Locale; import java.util.stream.Stream; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.junitpioneer.jupiter.DefaultLocale; /** * Tests for standard Converters. @@ -72,7 +74,7 @@ public class ConverterTests { assertThrows(ClassNotFoundException.class, () -> Converter.CLASS.apply("foo.bar")); assertNotNull(Converter.CLASS.apply(AClassWithoutADefaultConstructor.class.getName())); } - + @Test void testDate() throws Exception { assertThrows(java.text.ParseException.class, () -> Converter.DATE.apply("whatever")); @@ -91,6 +93,14 @@ public class ConverterTests { assertThrows(java.text.ParseException.class, () -> Converter.DATE.apply("Jun 06 17:48:57 EDT 2002")); } + @Test + @DefaultLocale(language = "de", country = "DE") + void testDateLocaleDe() throws Exception { + final Date expected = new Date(1023400137000L); + final String formatted = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy").format(expected); + assertEquals(expected, Converter.DATE.apply(formatted)); + } + @Test void testFile() throws Exception { final URL url = this.getClass().getClassLoader().getResource("./org/apache/commons/cli/existing-readable.file");
