public void show_issue_with_dates() throws Exception {
Date creationDate = DateUtils.parseDateTime("2014-01-22T19:10:03+0100");
Date updateDate = DateUtils.parseDateTime("2014-01-23T19:10:03+0100");
Date closedDate = DateUtils.parseDateTime("2014-01-24T19:10:03+0100");
DefaultIssue issue = createStandardIssue()
.setCreationDate(creationDate)
.setUpdateDate(updateDate)
.setCloseDate(closedDate);
when(issueService.getByKey(issue.key())).thenReturn(issue);
when(i18n.formatDateTime(any(Locale.class), eq(creationDate))).thenReturn("Jan 22, 2014 10:03 AM");
when(i18n.formatDateTime(any(Locale.class), eq(updateDate))).thenReturn("Jan 23, 2014 10:03 AM");
when(i18n.ageFromNow(any(Locale.class), eq(updateDate))).thenReturn("9 days");
when(i18n.formatDateTime(any(Locale.class), eq(closedDate))).thenReturn("Jan 24, 2014 10:03 AM");
MockUserSession.set();
WsTester.TestRequest request = tester.newGetRequest("api/issues", "show").setParam("key", issue.key());
request.execute().assertJson(getClass(), "show_issue_with_dates.json");
}