Search in sources :

Example 1 with DeleteIssueCommentResult

use of com.enonic.xp.issue.DeleteIssueCommentResult 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 2 with DeleteIssueCommentResult

use of com.enonic.xp.issue.DeleteIssueCommentResult 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 3 with DeleteIssueCommentResult

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

the class DeleteIssueCommentCommand method doExecute.

private DeleteIssueCommentResult doExecute() {
    validateBlockingChecks();
    NodeIds deletedIds = nodeService.deleteById(params.getComment());
    nodeService.refresh(RefreshMode.SEARCH);
    return new DeleteIssueCommentResult(deletedIds);
}
Also used : NodeIds(com.enonic.xp.node.NodeIds) DeleteIssueCommentResult(com.enonic.xp.issue.DeleteIssueCommentResult)

Example 4 with DeleteIssueCommentResult

use of com.enonic.xp.issue.DeleteIssueCommentResult 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

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