You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2008/04/07 11:55:12 UTC

svn commit: r645435 - /commons/proper/net/trunk/src/test/org/apache/commons/net/ftp/parser/FTPTimestampParserImplTest.java

Author: sebb
Date: Mon Apr  7 02:55:11 2008
New Revision: 645435

URL: http://svn.apache.org/viewvc?rev=645435&view=rev
Log:
Update setLenient tests:
- check shortdates work with lenient true or false for non-future dates
- add test for NET-211

Modified:
    commons/proper/net/trunk/src/test/org/apache/commons/net/ftp/parser/FTPTimestampParserImplTest.java

Modified: commons/proper/net/trunk/src/test/org/apache/commons/net/ftp/parser/FTPTimestampParserImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/test/org/apache/commons/net/ftp/parser/FTPTimestampParserImplTest.java?rev=645435&r1=645434&r2=645435&view=diff
==============================================================================
--- commons/proper/net/trunk/src/test/org/apache/commons/net/ftp/parser/FTPTimestampParserImplTest.java (original)
+++ commons/proper/net/trunk/src/test/org/apache/commons/net/ftp/parser/FTPTimestampParserImplTest.java Mon Apr  7 02:55:11 2008
@@ -224,14 +224,17 @@
 	}
 	
     /*
-     * Check how short date is interpreted at a given time
+     * Check how short date is interpreted at a given time.
+     * Check both with and without lenient future dates
      */
     private void checkShortParse(String msg, Calendar now, Calendar input) throws ParseException {
         checkShortParse(msg, now, input, false);
+        checkShortParse(msg, now, input, true);
     }
 
     /*
      * Check how short date is interpreted at a given time
+     * Check only using specified lenient future dates setting
      */
     private void checkShortParse(String msg, Calendar now, Calendar input, boolean lenient) throws ParseException {
         FTPTimestampParserImpl parser = new FTPTimestampParserImpl();
@@ -349,6 +352,14 @@
         GregorianCalendar target = (GregorianCalendar) now.clone();
         target.add(Calendar.DAY_OF_YEAR, +1); // tomorrow
         checkShortParse("2008-1-1",now,target, true);
+    }
+
+    public void testParseJan01() throws Exception {
+        GregorianCalendar now = new GregorianCalendar(2007, Calendar.JANUARY, 1, 12, 0);
+        checkShortParse("2007-01-01",now,now); // should always work
+        GregorianCalendar target = new GregorianCalendar(2006, Calendar.DECEMBER, 31, 12, 0);
+        checkShortParse("2006-12-31",now,target, true);
+        checkShortParse("2006-12-31",now,target, false);
     }
 
     /**