Package com.atlassian.jira.rest.client.api.domain

Examples of com.atlassian.jira.rest.client.api.domain.Worklog


public class WorklogJsonParserTest {
  @Test
  public void testParse() throws Exception {
    final WorklogJsonParser parser = new WorklogJsonParser();
    final Worklog worklog = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/worklog/valid.json"));
    assertEquals(toUri("http://localhost:8090/jira/rest/api/latest/worklog/10010"), worklog.getSelf());
    assertEquals(toUri("http://localhost:8090/jira/rest/api/latest/issue/TST-2"), worklog.getIssueUri());
    assertEquals(TestConstants.USER_ADMIN_BASIC_DEPRECATED, worklog.getAuthor());
    assertEquals(TestConstants.USER_ADMIN_BASIC_DEPRECATED, worklog.getUpdateAuthor());
    assertEquals("my first work", worklog.getComment());
    assertEquals(TestUtil.toDateTime("2010-08-17T16:35:47.466+0200"), worklog.getCreationDate());
    assertEquals(TestUtil.toDateTime("2010-08-17T16:35:47.466+0200"), worklog.getUpdateDate());
    assertEquals(TestUtil.toDateTime("2010-08-15T16:35:00.000+0200"), worklog.getStartDate());
    assertEquals(60, worklog.getMinutesSpent());
    assertNull(worklog.getVisibility());
  }
View Full Code Here


  }

  @Test
  public void testParseWithRoleLevel() throws Exception {
    final WorklogJsonParser parser = new WorklogJsonParser();
    final Worklog worklog = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/worklog/valid-roleLevel.json"));
    assertEquals(toUri("http://localhost:8090/jira/rest/api/latest/worklog/10011"), worklog.getSelf());
    assertEquals(toUri("http://localhost:8090/jira/rest/api/latest/issue/TST-2"), worklog.getIssueUri());
    assertEquals(TestConstants.USER1_BASIC_DEPRECATED, worklog.getAuthor());
    assertEquals(TestConstants.USER1_BASIC_DEPRECATED, worklog.getUpdateAuthor());
    assertEquals("another piece of work", worklog.getComment());
    assertEquals(TestUtil.toDateTime("2010-08-17T16:38:00.013+0200"), worklog.getCreationDate());
    assertEquals(TestUtil.toDateTime("2010-08-17T16:38:24.948+0200"), worklog.getUpdateDate());
    assertEquals(TestUtil.toDateTime("2010-08-17T16:37:00.000+0200"), worklog.getStartDate());
    assertEquals(Visibility.role("Developers"), worklog.getVisibility());
    assertEquals(15, worklog.getMinutesSpent());
  }
View Full Code Here

  }

  @Test
  public void testParseWithGroupLevel() throws Exception {
    final WorklogJsonParser parser = new WorklogJsonParser();
    final Worklog worklog = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/worklog/valid-groupLevel.json"));
    assertEquals(Visibility.group("jira-users"), worklog.getVisibility());
  }
View Full Code Here

  }

  @Test
  public void testParseWhenAuthorIsAnonymous() throws Exception {
    final WorklogJsonParser parser = new WorklogJsonParser();
    final Worklog worklog = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/worklog/valid-anonymousAuthor.json"));
    assertNull(worklog.getAuthor());
    assertNull(worklog.getUpdateAuthor());
  }
View Full Code Here

  }

  @Test
  public void testParseWhenAuthorIsAnonymousInOldRepresentation() throws Exception {
    final WorklogJsonParser parser = new WorklogJsonParser();
    final Worklog worklog = parser.parse(ResourceUtil
        .getJsonObjectFromResource("/json/worklog/valid-anonymousAuthor-oldRepresentation.json"));
    assertNull(worklog.getAuthor());
    assertNull(worklog.getUpdateAuthor());
  }
View Full Code Here

        resolveURI("rest/api/2/issue/10010/worklog/10012"),
        resolveURI("rest/api/2/issue/10010/worklog/10020"),
        resolveURI("rest/api/2/issue/10010/worklog/10021")
    ));

    final Worklog actualWorklog = Iterables.getLast(worklogs);
    final Worklog expectedWorklog = new Worklog(resolveURI("rest/api/2/issue/10010/worklog/10021"),
        resolveURI("rest/api/latest/issue/10010"), IntegrationTestUtil.USER_ADMIN, IntegrationTestUtil.USER_ADMIN,
        "Another work for 7 min", toDateTime("2010-08-27T15:00:02.104"), toDateTime("2010-08-27T15:00:02.104"),
        toDateTime("2010-08-27T14:59:00.000"), 7, null);
    assertEquals(expectedWorklog, actualWorklog);
View Full Code Here

TOP

Related Classes of com.atlassian.jira.rest.client.api.domain.Worklog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.