Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-5612

AssertCalendar needlessly compares timezone offsets

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • JCR Resource 2.7.4
    • JCR Resource 2.8.0
    • JCR
    • None

    Description

      The AssertCalendar class in the test code compares Calendar objects like this:

      assertEquals(expected.getTime(), actual.getTime());
      assertEquals(expected.getTimeZone().getRawOffset(), actual.getTimeZone().getRawOffset());
      

      Comparing the timezones is not needed IMO, Calendar internally stores stores the time in msec since the epoch, so comparing getTimeInMillis() is sufficient to declare two Calendars as pointing to the same time. For our tests, it's fine for the timezones to be different.

      Attachments

        Activity

          People

            bdelacretaz Bertrand Delacretaz
            bdelacretaz Bertrand Delacretaz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: