when(hTextFlowTarget.addReviewComment(commentContent, hPerson))
.thenReturn(hReviewComment);
when(hReviewComment.getId()).thenReturn(1L);
// When:
AddReviewCommentResult result = handler.execute(action, null);
// Then:
InOrder inOrder =
Mockito.inOrder(textFlowTargetDAO,
textFlowTargetReviewCommentsDAO,
hTextFlowTarget, workspace,
securityServiceImpl, identity);
inOrder.verify(securityServiceImpl).checkWorkspaceStatus(
action.getWorkspaceId());
inOrder.verify(textFlowTargetDAO).getTextFlowTarget(
transUnitId.getValue(), hLocale.getLocaleId());
inOrder.verify(identity).checkPermission("review-comment", hLocale,
hProject);
inOrder.verify(hTextFlowTarget).addReviewComment(commentContent,
hPerson);
inOrder.verify(textFlowTargetReviewCommentsDAO).flush();
inOrder.verify(workspace).publish(isA(AddReviewComment.class));
assertThat(result.getComment().getId(),
Matchers.equalTo(new ReviewCommentId(1L)));
}