Search in sources :

Example 1 with DeleteIssueCommentParams

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

the class DeleteIssueCommentCommandTest method testNoCommentId.

@Test
public void testNoCommentId() {
    final DeleteIssueCommentParams params = DeleteIssueCommentParams.create().build();
    final DeleteIssueCommentCommand command = createDeleteIssueCommentCommand(params);
    assertThrows(IllegalArgumentException.class, () -> command.execute());
}
Also used : DeleteIssueCommentParams(com.enonic.xp.issue.DeleteIssueCommentParams) Test(org.junit.jupiter.api.Test)

Example 2 with DeleteIssueCommentParams

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

the class DeleteIssueCommentCommandTest method delete.

@Test
public void delete() {
    DeleteIssueCommentParams params = DeleteIssueCommentParams.create().comment(NodeId.from(UUID.randomUUID())).build();
    final NodeIds nodeIds = NodeIds.from(params.getComment());
    final DeleteIssueCommentCommand command = createDeleteIssueCommentCommand(params);
    Mockito.when(this.nodeService.deleteById(Mockito.any(NodeId.class))).thenReturn(nodeIds);
    final DeleteIssueCommentResult result = command.execute();
    assertNotNull(result);
    assertEquals(1, result.getIds().getSize());
    assertEquals(params.getComment(), result.getIds().first());
}
Also used : NodeIds(com.enonic.xp.node.NodeIds) NodeId(com.enonic.xp.node.NodeId) DeleteIssueCommentParams(com.enonic.xp.issue.DeleteIssueCommentParams) DeleteIssueCommentResult(com.enonic.xp.issue.DeleteIssueCommentResult) Test(org.junit.jupiter.api.Test)

Example 3 with DeleteIssueCommentParams

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

the class IssueServiceImplTest_deleteComment method comments_deleteNotExisting.

@Test
public void comments_deleteNotExisting() throws Exception {
    DeleteIssueCommentParams params = DeleteIssueCommentParams.create().comment(NodeId.from(UUID.randomUUID())).build();
    final DeleteIssueCommentResult result = this.issueService.deleteComment(params);
    assertNotNull(result);
    assertEquals(0, result.getIds().getSize());
}
Also used : DeleteIssueCommentParams(com.enonic.xp.issue.DeleteIssueCommentParams) DeleteIssueCommentResult(com.enonic.xp.issue.DeleteIssueCommentResult) Test(org.junit.jupiter.api.Test)

Example 4 with DeleteIssueCommentParams

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

the class IssueServiceImplTest_deleteComment method comments_delete.

@Test
public void comments_delete() throws Exception {
    DeleteIssueCommentParams params = DeleteIssueCommentParams.create().comment(this.comment.getId()).build();
    final DeleteIssueCommentResult result = this.issueService.deleteComment(params);
    assertNotNull(result);
    assertEquals(1, result.getIds().getSize());
}
Also used : DeleteIssueCommentParams(com.enonic.xp.issue.DeleteIssueCommentParams) DeleteIssueCommentResult(com.enonic.xp.issue.DeleteIssueCommentResult) Test(org.junit.jupiter.api.Test)

Aggregations

DeleteIssueCommentParams (com.enonic.xp.issue.DeleteIssueCommentParams)4 Test (org.junit.jupiter.api.Test)4 DeleteIssueCommentResult (com.enonic.xp.issue.DeleteIssueCommentResult)3 NodeId (com.enonic.xp.node.NodeId)1 NodeIds (com.enonic.xp.node.NodeIds)1