Search in sources :

Example 6 with CaseCommentEvent

use of org.jbpm.casemgmt.api.event.CaseCommentEvent in project jbpm by kiegroup.

the class CommentNotificationEventListenerTest method testBuildParametersMap.

@Test
public void testBuildParametersMap() {
    CommentNotificationEventListener listener = new CommentNotificationEventListener();
    CommentInstanceImpl comment = new CommentInstanceImpl("john", "simple comment for @owner and @manager", new ArrayList<>());
    CaseCommentEvent event = new CaseCommentEvent("john", "CASE-00001", null, comment);
    StringBuilder commentContent = new StringBuilder(comment.getComment());
    Map<String, Object> parameters = listener.buildParams(event, commentContent);
    assertThat(parameters).hasSize(5);
    assertThat(parameters).containsEntry(AUTHOR_PARAM, comment.getAuthor()).containsEntry(CASE_ID_PARAM, "CASE-00001").containsEntry(COMMENT_ID_PARAM, comment.getId()).containsEntry(COMMENT_PARAM, commentContent.toString()).containsEntry(CREATED_AT_PARAM, comment.getCreatedAt());
}
Also used : CommentInstanceImpl(org.jbpm.casemgmt.impl.model.instance.CommentInstanceImpl) CaseCommentEvent(org.jbpm.casemgmt.api.event.CaseCommentEvent) Test(org.junit.Test)

Aggregations

CaseCommentEvent (org.jbpm.casemgmt.api.event.CaseCommentEvent)6 ArrayList (java.util.ArrayList)5 CommentInstanceImpl (org.jbpm.casemgmt.impl.model.instance.CommentInstanceImpl)5 Test (org.junit.Test)5 CaseFileInstance (org.jbpm.casemgmt.api.model.instance.CaseFileInstance)4 OrganizationalEntity (org.kie.api.task.model.OrganizationalEntity)3 TestNotificationPublisher (org.jbpm.casemgmt.impl.util.TestNotificationPublisher)2 User (org.kie.api.task.model.User)2 MessageFormat (java.text.MessageFormat)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 ServiceLoader (java.util.ServiceLoader)1 Set (java.util.Set)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 Collectors (java.util.stream.Collectors)1 CaseEventListener (org.jbpm.casemgmt.api.event.CaseEventListener)1