Search in sources :

Example 6 with CreateIssueCommentParams

use of com.enonic.xp.issue.CreateIssueCommentParams in project xp by enonic.

the class IssueServiceImplTest_comment method comment_noIssue.

@Test
public void comment_noIssue() throws Exception {
    final Instant created = Instant.now().minus(1, ChronoUnit.MINUTES);
    final PrincipalKey creator = PrincipalKey.from("user:store:me");
    final String creatorDisplayName = "Me Myself";
    final CreateIssueCommentParams params = CreateIssueCommentParams.create().text("text").issue(IssueId.create()).creator(creator).creatorDisplayName(creatorDisplayName).created(created).build();
    assertThrows(NodeNotFoundException.class, () -> this.issueService.createComment(params));
}
Also used : Instant(java.time.Instant) PrincipalKey(com.enonic.xp.security.PrincipalKey) CreateIssueCommentParams(com.enonic.xp.issue.CreateIssueCommentParams) Test(org.junit.jupiter.api.Test)

Example 7 with CreateIssueCommentParams

use of com.enonic.xp.issue.CreateIssueCommentParams in project xp by enonic.

the class CreateIssueCommentCommandTest method testNoText.

@Test
public void testNoText() {
    final CreateIssueCommentParams params = CreateIssueCommentParams.create().issue(IssueId.create()).build();
    final CreateIssueCommentCommand command = createIssueCommentCommand(params);
    assertThrows(IllegalArgumentException.class, () -> command.execute());
}
Also used : CreateIssueCommentParams(com.enonic.xp.issue.CreateIssueCommentParams) Test(org.junit.jupiter.api.Test)

Example 8 with CreateIssueCommentParams

use of com.enonic.xp.issue.CreateIssueCommentParams in project xp by enonic.

the class IssueServiceImplTest_comment method comment_issue.

@Test
public void comment_issue() throws Exception {
    Issue issue = this.createIssue(CreateIssueParams.create().title("issue-1"));
    final Instant created = Instant.now().minus(1, ChronoUnit.MINUTES);
    final PrincipalKey creator = PrincipalKey.from("user:store:me");
    final String creatorDisplayName = "Me Myself";
    final CreateIssueCommentParams params = CreateIssueCommentParams.create().text("text").issue(issue.getId()).creator(creator).creatorDisplayName(creatorDisplayName).created(created).build();
    final IssueComment comment = this.issueService.createComment(params);
    assertNotNull(comment);
    assertEquals("text", comment.getText());
    assertEquals(creator, comment.getCreator());
    assertEquals(creatorDisplayName, comment.getCreatorDisplayName());
    assertEquals(created, comment.getCreated());
}
Also used : Issue(com.enonic.xp.issue.Issue) Instant(java.time.Instant) IssueComment(com.enonic.xp.issue.IssueComment) PrincipalKey(com.enonic.xp.security.PrincipalKey) CreateIssueCommentParams(com.enonic.xp.issue.CreateIssueCommentParams) Test(org.junit.jupiter.api.Test)

Aggregations

CreateIssueCommentParams (com.enonic.xp.issue.CreateIssueCommentParams)8 Test (org.junit.jupiter.api.Test)8 PrincipalKey (com.enonic.xp.security.PrincipalKey)5 IssueComment (com.enonic.xp.issue.IssueComment)3 Instant (java.time.Instant)3 Issue (com.enonic.xp.issue.Issue)2 NodeId (com.enonic.xp.node.NodeId)2 NodeQuery (com.enonic.xp.node.NodeQuery)2 PropertyTree (com.enonic.xp.data.PropertyTree)1 Node (com.enonic.xp.node.Node)1 NodeNotFoundException (com.enonic.xp.node.NodeNotFoundException)1