@Test
public void testCollectOrgEntitiesByRole() {

    CommentNotificationEventListener listener = new CommentNotificationEventListener();
    
    List<String> mentionedRoles = new ArrayList<>();
    mentionedRoles.add("owner");
    mentionedRoles.add("manager");
    
    CommentInstanceImpl comment = new CommentInstanceImpl("john", "simple comment for @owner and @manager", new ArrayList<>());
    CaseFileInstance caseFile = buildCaseFile(mentionedRoles);
    
    CaseCommentEvent event = new CaseCommentEvent("john", caseFile.getCaseId() , caseFile, comment);
    
    StringBuilder commentContent = new StringBuilder(comment.getComment());
    Set<OrganizationalEntity> collected = listener.collectOrgEntitiesByRole(mentionedRoles, event, commentContent);
    
    assertThat(collected).hasSize(2);
    assertThat(collected).allMatch(item -> item instanceof User);
    assertThat(commentContent.toString()).isEqualTo("simple comment for john and mary");
}