Search in sources :

Example 1 with BPMNMessageReceivedEvent

use of org.activiti.api.process.model.events.BPMNMessageReceivedEvent in project Activiti by Activiti.

the class ToMessageReceivedConverterTest method fromShouldReturnConvertedEventAndSetProcessInstanceIdAndProcessDefinitionId.

@Test
public void fromShouldReturnConvertedEventAndSetProcessInstanceIdAndProcessDefinitionId() {
    // given
    ActivitiMessageEvent internalEvent = mock(ActivitiMessageEvent.class);
    given(internalEvent.getProcessDefinitionId()).willReturn("procDefId");
    given(internalEvent.getProcessInstanceId()).willReturn("procInstId");
    BPMNMessageImpl bpmnMessage = new BPMNMessageImpl("myMessage");
    given(bpmnMessageConverter.convertToBPMNMessage(internalEvent)).willReturn(bpmnMessage);
    // when
    BPMNMessageReceivedEvent messageEvent = toMessageConverter.from(internalEvent).orElse(null);
    // then
    assertThat(messageEvent).isNotNull();
    assertThat(messageEvent.getProcessInstanceId()).isEqualTo("procInstId");
    assertThat(messageEvent.getProcessDefinitionId()).isEqualTo("procDefId");
    assertThat(messageEvent.getEntity()).isEqualTo(bpmnMessage);
}
Also used : BPMNMessageReceivedEvent(org.activiti.api.process.model.events.BPMNMessageReceivedEvent) BPMNMessageImpl(org.activiti.api.runtime.model.impl.BPMNMessageImpl) ActivitiMessageEvent(org.activiti.engine.delegate.event.ActivitiMessageEvent) Test(org.junit.jupiter.api.Test)

Aggregations

BPMNMessageReceivedEvent (org.activiti.api.process.model.events.BPMNMessageReceivedEvent)1 BPMNMessageImpl (org.activiti.api.runtime.model.impl.BPMNMessageImpl)1 ActivitiMessageEvent (org.activiti.engine.delegate.event.ActivitiMessageEvent)1 Test (org.junit.jupiter.api.Test)1