Skip to content

Commit 1d040ce

Browse files
committed
Renaming YYYY_MM_YY to YYYY_MM_DD as that seems like a much more accurate name
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/cli/trunk@412458 13f79535-47bb-0310-9956-ffa450edef68
1 parent 08002a7 commit 1d040ce

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/test/org/apache/commons/cli2/option/ArgumentTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static Argument buildPathArgument() {
6363

6464
public static Argument buildDateLimitArgument() {
6565
return new ArgumentImpl("limit", "the last acceptable date", 0, 1, '=', '\0',
66-
new DateValidator(DateValidatorTest.YYYY_MM_YY), null, null, 0);
66+
new DateValidator(DateValidatorTest.YYYY_MM_DD), null, null, 0);
6767
}
6868

6969
public static Argument buildTargetsArgument() {
@@ -91,15 +91,15 @@ public static Argument buildBoundsArgument() {
9191
public void testNew() {
9292
try {
9393
new ArgumentImpl("limit", "the last acceptable date", 10, 5, '=', '\0',
94-
new DateValidator(DateValidatorTest.YYYY_MM_YY), null, null, 0);
94+
new DateValidator(DateValidatorTest.YYYY_MM_DD), null, null, 0);
9595
} catch (IllegalArgumentException e) {
9696
assertEquals(resources.getMessage("Argument.minimum.exceeds.maximum"), e.getMessage());
9797
}
9898

9999
{
100100
ArgumentImpl arg =
101101
new ArgumentImpl(null, "the last acceptable date", 5, 5, '=', '\0',
102-
new DateValidator(DateValidatorTest.YYYY_MM_YY), null, null, 0);
102+
new DateValidator(DateValidatorTest.YYYY_MM_DD), null, null, 0);
103103
assertEquals("wrong arg name", "arg", arg.getPreferredName());
104104
}
105105

@@ -108,7 +108,7 @@ public void testNew() {
108108

109109
try {
110110
new ArgumentImpl(null, "the last acceptable date", 1, 1, '=', '\0',
111-
new DateValidator(DateValidatorTest.YYYY_MM_YY), null, defaults, 0);
111+
new DateValidator(DateValidatorTest.YYYY_MM_DD), null, defaults, 0);
112112
} catch (IllegalArgumentException exp) {
113113
assertEquals(resources.getMessage("Argument.too.few.defaults"), exp.getMessage());
114114
}
@@ -120,7 +120,7 @@ public void testNew() {
120120
defaults.add("2");
121121

122122
new ArgumentImpl(null, "the last acceptable date", 1, 1, '=', '\0',
123-
new DateValidator(DateValidatorTest.YYYY_MM_YY), null, defaults, 0);
123+
new DateValidator(DateValidatorTest.YYYY_MM_DD), null, defaults, 0);
124124
} catch (IllegalArgumentException exp) {
125125
assertEquals(resources.getMessage("Argument.too.many.defaults"), exp.getMessage());
126126
}
@@ -367,7 +367,7 @@ public void testValidate_Validator()
367367

368368
option.validate(commandLine, option);
369369
assertContentsEqual(Arrays.asList(new Object[] {
370-
DateValidatorTest.YYYY_MM_YY.parse("2004-01-01")
370+
DateValidatorTest.YYYY_MM_DD.parse("2004-01-01")
371371
}), commandLine.getValues(option));
372372
}
373373

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public class DateValidatorTest
4040
extends TestCase {
4141
private static final ResourceHelper resources = ResourceHelper.getResourceHelper();
4242
public static final DateFormat D_M_YY = new SimpleDateFormat("d/M/yy");
43-
public static final DateFormat YYYY_MM_YY = new SimpleDateFormat("yyyy-MM-dd");
44-
private List formats = Arrays.asList(new Object[] { D_M_YY, YYYY_MM_YY });
43+
public static final DateFormat YYYY_MM_DD = new SimpleDateFormat("yyyy-MM-dd");
44+
private List formats = Arrays.asList(new Object[] { D_M_YY, YYYY_MM_DD });
4545

4646
public void testSingleFormatValidate()
4747
throws InvalidArgumentException {
@@ -52,7 +52,7 @@ public void testSingleFormatValidate()
5252
validator.validate(list);
5353

5454
final Iterator i = list.iterator();
55-
assertEquals("2003-12-23", YYYY_MM_YY.format((Date) i.next()));
55+
assertEquals("2003-12-23", YYYY_MM_DD.format((Date) i.next()));
5656
assertFalse(i.hasNext());
5757
}
5858

@@ -65,7 +65,7 @@ public void testDefaultDateFormatValidate()
6565
validator.validate(list);
6666

6767
final Iterator i = list.iterator();
68-
// CLI-40: For some reason, the YYYY_MM_YY object gets quite
68+
// CLI-40: For some reason, the YYYY_MM_DD object gets quite
6969
// confused here and returns 2003-12-22. If we make a new one
7070
// there is no problem.
7171
assertEquals("2003-12-23", new SimpleDateFormat("yyyy-MM-dd").format((Date) i.next()));
@@ -123,8 +123,8 @@ public void testValidate()
123123
validator.validate(list);
124124

125125
final Iterator i = list.iterator();
126-
assertEquals("2003-12-23", YYYY_MM_YY.format((Date) i.next()));
127-
assertEquals("2002-10-12", YYYY_MM_YY.format((Date) i.next()));
126+
assertEquals("2003-12-23", YYYY_MM_DD.format((Date) i.next()));
127+
assertEquals("2002-10-12", YYYY_MM_DD.format((Date) i.next()));
128128
assertFalse(i.hasNext());
129129
}
130130

0 commit comments

Comments
 (0)