Skip to content

Commit c967bd6

Browse files
committed
Modifying the test so it creates a new format object rather than reusing the static one. For some reason it gives the wrong response and it's hard to see why given that it works for other methods and JUnit is single threaded. This is discussed in CLI-40
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/cli/trunk@412456 13f79535-47bb-0310-9956-ffa450edef68
1 parent 5310d6a commit c967bd6

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/test/org/apache/commons/cli2/validation/DateValidatorTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ public void testDefaultDateFormatValidate()
6565
validator.validate(list);
6666

6767
final Iterator i = list.iterator();
68-
assertEquals("2003-12-23", YYYY_MM_YY.format((Date) i.next()));
68+
// CLI-40: For some reason, the YYYY_MM_YY object gets quite
69+
// confused here and returns 2003-12-22. If we make a new one
70+
// there is no problem.
71+
assertEquals("2003-12-23", new SimpleDateFormat("yyyy-MM-dd").format((Date) i.next()));
6972
assertFalse(i.hasNext());
7073
}
7174

0 commit comments

Comments
 (0)