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

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

    [ https://issues.apache.org/jira/browse/SLING-5612?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15197253#comment-15197253 ] 

Robert Munteanu commented on SLING-5612:
----------------------------------------

Looks good to me, thanks for looking into this

> 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)