commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r905721 - /commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/time/DateUtilsTest.java
Date Tue, 02 Feb 2010 17:37:33 GMT
Author: sebb
Date: Tue Feb  2 17:37:31 2010
New Revision: 905721

URL: http://svn.apache.org/viewvc?rev=905721&view=rev
Log:
SimpleDateFormat format 'Z' is Java 1.4+
Correct comment and test name: LANG-520 => LANG-530

Modified:
    commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/time/DateUtilsTest.java

Modified: commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/time/DateUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/time/DateUtilsTest.java?rev=905721&r1=905720&r2=905721&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/time/DateUtilsTest.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/time/DateUtilsTest.java
Tue Feb  2 17:37:31 2010
@@ -1172,13 +1172,17 @@
         TimeZone.setDefault(defaultZone);
     }
 
-    // http://issues.apache.org/jira/browse/LANG-520
-    public void testLang520() throws ParseException {
-        Date d = new Date();
-        String isoDateStr = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(d);
-        Date d2 = DateUtils.parseDate(isoDateStr, new String[] { DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern()
});
-        // the format loses milliseconds so have to reintroduce them
-        assertEquals("Date not equal to itself ISO formatted and parsed", d.getTime(), d2.getTime()
+ d.getTime() % 1000); 
+    // http://issues.apache.org/jira/browse/LANG-530
+    public void testLang530() throws ParseException {
+        if (SystemUtils.isJavaVersionAtLeast(1.4f)) {
+            Date d = new Date();
+            String isoDateStr = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(d);
+            Date d2 = DateUtils.parseDate(isoDateStr, new String[] { DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern()
});
+            // the format loses milliseconds so have to reintroduce them
+            assertEquals("Date not equal to itself ISO formatted and parsed", d.getTime(),
d2.getTime() + d.getTime() % 1000);
+        } else {
+            this.warn("WARNING: Cannot test SimpleDateFormat with 'Z' since the current version
is " + SystemUtils.JAVA_VERSION);
+        }
     }
     
     /**



Mime
View raw message