@Test public void testCreatedOn() throws IOException, JSONException { List<Issue> redmine11Issues = loadRedmine11Issues(); Issue issue = RedmineTestUtils.findIssueInList(redmine11Issues, 39); DateComparator.testLongDate( 2011, Calendar.FEBRUARY, 12, 16, 0, 31, "GMT-8", issue.getCreatedOn()); }
@Test public void testUpdatedOn() throws IOException, JSONException { List<Issue> redmine11Issues = loadRedmine11Issues(); Issue issue = RedmineTestUtils.findIssueInList(redmine11Issues, 39); DateComparator.testLongDate( 2011, Calendar.SEPTEMBER, 17, 21, 28, 45, "GMT-8", issue.getUpdatedOn()); }
@Test public void testParseTimeEntries() throws IOException, JSONException { String xml = MyIOUtils.getResourceAsString("redmine_time_entries.json"); List<TimeEntry> objects = JsonInput.getListOrEmpty( RedmineJSONParser.getResponse(xml), "time_entries", RedmineJSONParser.TIME_ENTRY_PARSER); Integer objId = 2; TimeEntry obj2 = RedmineTestUtils.findTimeEntry(objects, objId); Assert.assertNotNull(obj2); Integer expectedIssueId = 44; String expectedProjectName = "Permanent test project for Task Adapter"; Integer expectedProjectId = 1; String expectedUserName = "******"; Integer expectedUserId = 1; String expectedActivityName = "Design"; Integer expectedActivityId = 8; Float expectedHours = 2f; Assert.assertEquals(objId, obj2.getId()); Assert.assertEquals(expectedIssueId, obj2.getIssueId()); Assert.assertEquals(expectedProjectName, obj2.getProjectName()); Assert.assertEquals(expectedProjectId, obj2.getProjectId()); Assert.assertEquals(expectedUserName, obj2.getUserName()); Assert.assertEquals(expectedUserId, obj2.getUserId()); Assert.assertEquals(expectedActivityName, obj2.getActivityName()); Assert.assertEquals(expectedActivityId, obj2.getActivityId()); Assert.assertEquals(expectedHours, obj2.getHours()); Assert.assertEquals("spent 2 hours working on ABC", obj2.getComment()); DateComparator.testLongDate( 2011, Calendar.JANUARY, 31, 11, 10, 40, "GMT-8", obj2.getCreatedOn()); DateComparator.testLongDate( 2011, Calendar.JANUARY, 31, 11, 12, 32, "GMT-8", obj2.getUpdatedOn()); DateComparator.testShortDate(2011, Calendar.JANUARY, 30, obj2.getSpentOn()); }