DaanHoogland commented on a change in pull request #2392: dateutil: 
constistency of tzdate input and output
URL: https://github.com/apache/cloudstack/pull/2392#discussion_r160346422
 
 

 ##########
 File path: utils/src/test/java/com/cloud/utils/DateUtilTest.java
 ##########
 @@ -44,17 +47,25 @@ public static void main(String[] args) {
         if (args.length == 2) {
             System.out.println("Next run time: " + 
DateUtil.getNextRunTime(IntervalType.getIntervalType(args[0]), args[1], "GMT", 
time).toString());
         }
+    }
 
-        time = new Date();
+    @Test
+    public void zonedTimeFormatLegacy() throws ParseException {
+        Date time = new Date();
         DateFormat dfDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'Z");
         String str = dfDate.format(time);
-        System.out.println("Formated TZ time string : " + str);
-        try {
-            Date dtParsed = DateUtil.parseTZDateString(str);
-            System.out.println("Parsed TZ time string : " + 
dtParsed.toString());
-        } catch (ParseException e) {
-            System.err.println("Parsing failed\n string : " + str + 
"\nexception :" + e.getLocalizedMessage());
-        }
+        Date dtParsed = DateUtil.parseTZDateString(str);
+
+        assertEquals(time, dtParsed);
 
 Review comment:
   I don't think these will be the same objects only representing the same date 
but as one is created from a string it would not include microseconds. This is 
why i compared the string representations.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to