Skip to content

Commit 4eed381

Browse files
committed
Add ConverterTests.testDateLocaleDe()
1 parent 9f540c1 commit 4eed381

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/test/java/org/apache/commons/cli/ConverterTests.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ Licensed to the Apache Software Foundation (ASF) under one or more
2626
import java.util.ArrayList;
2727
import java.util.Date;
2828
import java.util.List;
29+
import java.util.Locale;
2930
import java.util.stream.Stream;
3031

3132
import org.junit.jupiter.api.Test;
3233
import org.junit.jupiter.params.ParameterizedTest;
3334
import org.junit.jupiter.params.provider.Arguments;
3435
import org.junit.jupiter.params.provider.MethodSource;
36+
import org.junitpioneer.jupiter.DefaultLocale;
3537

3638
/**
3739
* Tests for standard Converters.
@@ -72,7 +74,7 @@ void testClass() throws Exception {
7274
assertThrows(ClassNotFoundException.class, () -> Converter.CLASS.apply("foo.bar"));
7375
assertNotNull(Converter.CLASS.apply(AClassWithoutADefaultConstructor.class.getName()));
7476
}
75-
77+
7678
@Test
7779
void testDate() throws Exception {
7880
assertThrows(java.text.ParseException.class, () -> Converter.DATE.apply("whatever"));
@@ -91,6 +93,14 @@ void testDate() throws Exception {
9193
assertThrows(java.text.ParseException.class, () -> Converter.DATE.apply("Jun 06 17:48:57 EDT 2002"));
9294
}
9395

96+
@Test
97+
@DefaultLocale(language = "de", country = "DE")
98+
void testDateLocaleDe() throws Exception {
99+
final Date expected = new Date(1023400137000L);
100+
final String formatted = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy").format(expected);
101+
assertEquals(expected, Converter.DATE.apply(formatted));
102+
}
103+
94104
@Test
95105
void testFile() throws Exception {
96106
final URL url = this.getClass().getClassLoader().getResource("./org/apache/commons/cli/existing-readable.file");

0 commit comments

Comments
 (0)