Skip to content

Commit fd309f3

Browse files
committed
[CLI-327] Fix for expected textual date values. #244
1 parent a5acbe4 commit fd309f3

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/changes/changes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<action type="fix" dev="ggregory" due-to="Gary Gregory">Avoid NullPointerException in Util.stripLeadingAndTrailingQuotes(String).</action>
2929
<action type="fix" issue="CLI-320" dev="ggregory" due-to="Paul King, Claude Warren">Awkward behavior of Option.builder() for multiple optional args.</action>
3030
<action type="fix" issue="CLI-325" dev="ggregory" due-to="Claude Warren">Properties from multiple arguments with value separator. #237.</action>
31+
<action type="fix" issue="CLI-327" dev="ggregory" due-to="Claude Warren, Gary Gregory">Fix for expected textual date values. #244.</action>
3132
<!-- ADD -->
3233
<action type="add" issue="CLI-321" dev="ggregory" due-to="Claude Warren, Gary Gregory">Add and use a Converter interface and implementations without using BeanUtils #216.</action>
3334
<action type="add" dev="ggregory" due-to="Gary Gregory">Add Maven property project.build.outputTimestamp for build reproducibility.</action>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ public void dateTests() throws Exception {
8484
* time zone.
8585
*/
8686
final Date expected = new Date(1023400137000L);
87-
DateFormat dateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
88-
String formatted = dateFormat.format(expected);
87+
final DateFormat dateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
88+
final String formatted = dateFormat.format(expected);
8989
assertEquals(expected, Converter.DATE.apply(formatted));
9090

9191
assertThrows(java.text.ParseException.class, () -> Converter.DATE.apply("Jun 06 17:48:57 EDT 2002"));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public void testSimplePattern() throws Exception {
135135
*/
136136
final Options options = PatternOptionBuilder.parsePattern("a:b@cde>f+n%t/m*z#");
137137
final Date expectedDate = new Date(1023400137000L);
138-
DateFormat dateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
138+
final DateFormat dateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
139139
final String[] args = {"-c", "-a", "foo", "-b", "java.util.Vector", "-e", "build.xml", "-f", "java.util.Calendar", "-n", "4.5", "-t",
140140
"https://commons.apache.org", "-z", dateFormat.format(expectedDate), "-m", "test*"};
141141

0 commit comments

Comments
 (0)