More tests for Feb 29
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/net/trunk@1725999 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/test/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImplTest.java b/src/test/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImplTest.java
index 72d1465..5d81382 100644
--- a/src/test/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImplTest.java
+++ b/src/test/java/org/apache/commons/net/ftp/parser/FTPTimestampParserImplTest.java
@@ -404,6 +404,27 @@
checkShortParse("Feb 29th 2000",now,new GregorianCalendar(year, Calendar.FEBRUARY,29));
}
+ public void testFeb29LeapYear2() throws Exception{
+ int year = 2000; // Use same year for current and short date
+ GregorianCalendar now = new GregorianCalendar(year, Calendar.MARCH, 1, 12, 0);
+ checkShortParse("Feb 29th 2000", now, new GregorianCalendar(year, Calendar.FEBRUARY, 29));
+ }
+
+ // same date feb 29
+ public void testFeb29LeapYear3() throws Exception{
+ int year = 2000; // Use same year for current and short date
+ GregorianCalendar now = new GregorianCalendar(year, Calendar.FEBRUARY, 29, 12, 0);
+ checkShortParse("Feb 29th 2000", now, new GregorianCalendar(year, Calendar.FEBRUARY, 29));
+ }
+
+ // future dated Feb 29
+ public void testFeb29LeapYear4() throws Exception{
+ int year = 2000; // Use same year for current and short date
+ GregorianCalendar now = new GregorianCalendar(year, Calendar.FEBRUARY, 28, 12, 0);
+ // Must allow lenient future date here
+ checkShortParse("Feb 29th 2000", now, new GregorianCalendar(year, Calendar.FEBRUARY, 29), true);
+ }
+
// Test Feb 29 for a known non-leap year - should fail
public void testFeb29NonLeapYear(){
GregorianCalendar server = new GregorianCalendar(1999, Calendar.APRIL, 1, 12, 0);