AsyncCaseInstanceAuditEventProducer implements CaseEventListener, Cacheable { @Override public void afterCaseRoleAssignmentAdded(CaseRoleAssignmentEvent event) { CaseRoleAssignmentLog assignmentLog = new CaseRoleAssignmentLog(-1L, event.getCaseId(), event.getRole(), event.getEntity()); sendMessage(AFTER_CASE_ROLE_ASSIGNMENT_ADDED_EVENT_TYPE, new AuditCaseInstanceData(event.getCaseId(), null, Collections.singletonList(assignmentLog)), 4); } AsyncCaseInstanceAuditEventProducer(); ConnectionFactory getConnectionFactory(); void setConnectionFactory(ConnectionFactory connectionFactory); Queue getQueue(); void setQueue(Queue queue); boolean isTransacted(); void setTransacted(boolean transacted); @Override void afterCaseStarted(CaseStartEvent event); @Override void afterCaseReopen(CaseReopenEvent event); @Override void afterCaseRoleAssignmentAdded(CaseRoleAssignmentEvent event); @Override void afterCaseRoleAssignmentRemoved(CaseRoleAssignmentEvent event); @Override void afterCaseDataAdded(CaseDataEvent event); @Override void afterCaseDataRemoved(CaseDataEvent event); @Override void close();  }
@Test public void testCaseRoleAssignmentAdded() throws JMSException { OrganizationalEntity entity = mock(OrganizationalEntity.class); when(entity.getId()).thenReturn("john"); CaseFileInstanceImpl caseFile = new CaseFileInstanceImpl("TEST-01", "case"); CaseRoleAssignmentEvent event = new CaseRoleAssignmentEvent("user", "TEST-01", caseFile, "owner", entity); logProducer.afterCaseRoleAssignmentAdded(event); verify(message, times(1)).setStringProperty(eq("LogType"), eq("Case")); verify(message, times(1)).setIntProperty(eq("EventType"), eq(AFTER_CASE_ROLE_ASSIGNMENT_ADDED_EVENT_TYPE)); verify(producer, times(1)).setPriority(eq(4)); verify(producer, times(1)).send(eq(message)); }