ToSignalConverter { @SuppressWarnings("unchecked") public BPMNSignal from(ActivitiSignalEvent internalEvent) { BPMNSignalImpl signal = new BPMNSignalImpl(internalEvent.getActivityId()); signal.setProcessDefinitionId(internalEvent.getProcessDefinitionId()); signal.setProcessInstanceId(internalEvent.getProcessInstanceId()); SignalPayload signalPayload = ProcessPayloadBuilder.signal() .withName(internalEvent.getSignalName()) .build(); if (internalEvent.getSignalData() != null) { Map<String, Object> sourceVariables = (Map<String, Object>) internalEvent.getSignalData(); signalPayload.setVariables(new HashMap<>(sourceVariables)); } signal.setSignalPayload(signalPayload); return signal; }  @SuppressWarnings("unchecked") BPMNSignal from(ActivitiSignalEvent internalEvent);  }
@Test public void fromShouldSetMetaInfoAndVariables() { ActivitiSignalEventImpl internalEvent = new ActivitiSignalEventImpl(ActivitiEventType.ACTIVITY_SIGNALED); internalEvent.setSignalName("go"); internalEvent.setSignalData(singletonMap("signalVar", "value")); internalEvent.setProcessDefinitionId("procDefId"); internalEvent.setProcessInstanceId("procInstId"); BPMNSignal signal = toSignalConverter.from(internalEvent); assertThat(signal.getSignalPayload().getName()).isEqualTo("go"); assertThat(signal.getSignalPayload().getVariables()).containsEntry("signalVar", "value"); assertThat(signal.getProcessDefinitionId()).isEqualTo("procDefId"); assertThat(signal.getProcessInstanceId()).isEqualTo("procInstId"); }