commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1644685 - /commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/FTPParseTestFramework.java
Date Thu, 11 Dec 2014 15:58:34 GMT
Author: sebb
Date: Thu Dec 11 15:58:34 2014
New Revision: 1644685

URL: http://svn.apache.org/r1644685
Log:
Need to check all significant units are set ...

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

Modified: commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/FTPParseTestFramework.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/FTPParseTestFramework.java?rev=1644685&r1=1644684&r2=1644685&view=diff
==============================================================================
--- commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/FTPParseTestFramework.java
(original)
+++ commons/proper/net/trunk/src/test/java/org/apache/commons/net/ftp/parser/FTPParseTestFramework.java
Thu Dec 11 15:58:34 2014
@@ -171,10 +171,18 @@ public abstract class FTPParseTestFramew
         assertNotNull("Could not parse "+listEntry, file);
         Calendar stamp = file.getTimestamp();
         assertNotNull("Failed to parse time in "+listEntry, stamp);
-        assertTrue("Expected set "+expectedPrecision+" in "+listEntry, stamp.isSet(expectedPrecision.unit));
         final int ordinal = expectedPrecision.ordinal();
+        final CalendarUnit[] values = CalendarUnit.values();
+        // Check expected unit and all more significant ones are set
+        // This is needed for FTPFile.toFormattedString() to work correctly
+        for(int i = ordinal; i < values.length; i++) {
+            CalendarUnit unit = values[i];
+            assertTrue("Expected set "+unit+" in "+listEntry, stamp.isSet(unit.unit));  
         
+        }
+        // Check previous entry (if any) is not set
+        // This is also needed for FTPFile.toFormattedString() to work correctly
         if (ordinal > 0) {
-            final CalendarUnit prevUnit = CalendarUnit.values()[ordinal-1];
+            final CalendarUnit prevUnit = values[ordinal-1];
             assertFalse("Expected not set "+prevUnit+" in "+listEntry, stamp.isSet(prevUnit.unit));
           
         }
     }



Mime
View raw message