jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • FEST
  • FEST-423

User-friendly date and calendar formatting

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: FEST-Assert 1.3
  • Fix Version/s: FEST-Assert 1.4
  • Component/s: Assert
  • Labels:
    None
  • Patch Submitted:
    Yes

Description

The following code:


will produce somewhat awkward comparison failure message:

java.lang.AssertionError: expected:
<java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllFieldsSet=false,lenient=true,zone=
sun.util.calendar.ZoneInfo[id="Europe/Oslo",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=141,lastRule=java.util.SimpleTimeZone[id=Europe/Oslo,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],
firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=?,YEAR=2010,MONTH=1,WEEK_OF_YEAR=?,WEEK_OF_MONTH=?,DAY_OF_MONTH=2,DAY_OF_YEAR=?,DAY_OF_WEEK=?,DAY_OF_WEEK_IN_MONTH=?,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=?,ZONE_OFFSET=?,DST_OFFSET=?]> 
but was:
<java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllFieldsSet=false,lenient=true,zone=
sun.util.calendar.ZoneInfo[id="Europe/Oslo",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=141,lastRule=java.util.SimpleTimeZone[id=Europe/Oslo,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],
firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=?,YEAR=2010,MONTH=1,WEEK_OF_YEAR=?,WEEK_OF_MONTH=?,DAY_OF_MONTH=1,DAY_OF_YEAR=?,DAY_OF_WEEK=?,DAY_OF_WEEK_IN_MONTH=?,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=?,ZONE_OFFSET=?,DST_OFFSET=?]>

It would be nice to use standard formatting for Date and Calendar instances. Simple implementation can be found in this branch (change in FEST-util).

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Tomasz Nurkiewicz added a comment - 22/Jan/11 1:07 PM

Can't edit original issue description, sorry: [...] The following code:

assertThat(new GregorianCalendar(2010, 1, 1)).isEqualTo(new GregorianCalendar(2010, 1, 2));

[...]

Show
Tomasz Nurkiewicz added a comment - 22/Jan/11 1:07 PM Can't edit original issue description, sorry: [...] The following code:
assertThat(new GregorianCalendar(2010, 1, 1)).isEqualTo(new GregorianCalendar(2010, 1, 2));
[...]
Hide
Permalink
Joel Costigliola added a comment - 25/Jan/11 3:06 PM

I agree and think it could be done in Fest 1.4 release.
Note that we have planned to adress FEST-63 (Date assertions) in Fest 1.5 release (also no fix version is set yet)

Show
Joel Costigliola added a comment - 25/Jan/11 3:06 PM I agree and think it could be done in Fest 1.4 release. Note that we have planned to adress FEST-63 (Date assertions) in Fest 1.5 release (also no fix version is set yet)
Hide
Permalink
Joel Costigliola added a comment - 25/Jan/11 3:08 PM

By the way, thanks for the implementation, I will integrate it this week.

Show
Joel Costigliola added a comment - 25/Jan/11 3:08 PM By the way, thanks for the implementation, I will integrate it this week.
Hide
Permalink
Joel Costigliola added a comment - 30/Jan/11 4:01 PM

I change the date format to ISO 8601 standard to be independent from locale.

Show
Joel Costigliola added a comment - 30/Jan/11 4:01 PM I change the date format to ISO 8601 standard to be independent from locale.

People

  • Assignee:
    Joel Costigliola
    Reporter:
    Tomasz Nurkiewicz
Vote (0)
Watch (0)

Dates

  • Created:
    22/Jan/11 1:03 PM
    Updated:
    30/Jan/11 4:01 PM
    Resolved:
    30/Jan/11 4:01 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.