You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Bertrand Delacretaz (JIRA)" <ji...@apache.org> on 2016/03/16 08:42:33 UTC

[jira] [Resolved] (SLING-5612) AssertCalendar needlessly compares timezone offsets

     [ https://issues.apache.org/jira/browse/SLING-5612?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bertrand Delacretaz resolved SLING-5612.
----------------------------------------
    Resolution: Fixed

Changed the comparison method in http://svn.apache.org/r1735193

[~joelrich], [~rombert] IIUC you created that {{AssertCalendar}} class as part of SLING-4585, do you agree with this change? If not please reopen this ticket.

> AssertCalendar needlessly compares timezone offsets
> ---------------------------------------------------
>
>                 Key: SLING-5612
>                 URL: https://issues.apache.org/jira/browse/SLING-5612
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR Resource 2.7.4
>            Reporter: Bertrand Delacretaz
>            Assignee: Bertrand Delacretaz
>            Priority: Minor
>             Fix For: JCR Resource 2.8.0
>
>
> The {{AssertCalendar}} class in the test code compares Calendar objects like this:
> {code}
> assertEquals(expected.getTime(), actual.getTime());
> assertEquals(expected.getTimeZone().getRawOffset(), actual.getTimeZone().getRawOffset());
> {code}
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)