### Question:
ToCloudProcessRuntimeEventConverter { public CloudProcessStartedEvent from(ProcessStartedEvent event) { CloudProcessStartedEventImpl cloudProcessStartedEvent = new CloudProcessStartedEventImpl(event.getEntity(), event.getNestedProcessDefinitionId(), event.getNestedProcessInstanceId()); runtimeBundleInfoAppender.appendRuntimeBundleInfoTo(cloudProcessStartedEvent); return cloudProcessStartedEvent; } ToCloudProcessRuntimeEventConverter(RuntimeBundleInfoAppender runtimeBundleInfoAppender); CloudProcessStartedEvent from(ProcessStartedEvent event); CloudProcessCreatedEvent from(ProcessCreatedEvent event); CloudProcessUpdatedEvent from(ProcessUpdatedEvent event); CloudProcessResumedEvent from(ProcessResumedEvent event); CloudProcessSuspendedEvent from(ProcessSuspendedEvent event); CloudProcessCompletedEvent from(ProcessCompletedEvent event); CloudProcessCancelledEvent from(ProcessCancelledEvent event); CloudBPMNActivityStartedEvent from(BPMNActivityStartedEvent event); CloudBPMNActivityCompletedEvent from(BPMNActivityCompletedEvent event); CloudBPMNActivityCancelledEvent from(BPMNActivityCancelledEvent event); CloudBPMNSignalReceivedEvent from(BPMNSignalReceivedEvent event); CloudSequenceFlowTakenEvent from(BPMNSequenceFlowTakenEvent event); CloudProcessDeployedEvent from(ProcessDeployedEvent event); CloudStartMessageDeployedEvent from(StartMessageDeployedEvent event); CloudMessageSubscriptionCancelledEvent from(MessageSubscriptionCancelledEvent event); CloudBPMNTimerFiredEvent from(BPMNTimerFiredEvent event); CloudBPMNTimerScheduledEvent from(BPMNTimerScheduledEvent event); CloudBPMNTimerCancelledEvent from(BPMNTimerCancelledEvent event); CloudBPMNTimerFailedEvent from(BPMNTimerFailedEvent event); CloudBPMNTimerExecutedEvent from(BPMNTimerExecutedEvent event); CloudBPMNTimerRetriesDecrementedEvent from(BPMNTimerRetriesDecrementedEvent event); CloudBPMNMessageSentEvent from(BPMNMessageSentEvent event); CloudBPMNMessageReceivedEvent from(BPMNMessageReceivedEvent event); CloudBPMNMessageWaitingEvent from(BPMNMessageWaitingEvent event); CloudBPMNErrorReceivedEvent from(BPMNErrorReceivedEvent event);  }### Answer:
@Test public void fromShouldConvertInternalProcessStartedEventToExternalEvent() { ProcessInstanceImpl processInstance = new ProcessInstanceImpl(); processInstance.setId("10"); processInstance.setProcessDefinitionId("myProcessDef"); ProcessStartedEventImpl event = new ProcessStartedEventImpl(processInstance); event.setNestedProcessDefinitionId("myParentProcessDef"); event.setNestedProcessInstanceId("2"); CloudProcessStartedEvent processStarted = converter.from(event); assertThat(processStarted).isInstanceOf(CloudProcessStartedEvent.class); assertThat(processStarted.getEntity().getId()).isEqualTo("10"); assertThat(processStarted.getEntity().getProcessDefinitionId()).isEqualTo("myProcessDef"); assertThat(processStarted.getNestedProcessDefinitionId()).isEqualTo("myParentProcessDef"); assertThat(processStarted.getNestedProcessInstanceId()).isEqualTo("2"); verify(runtimeBundleInfoAppender).appendRuntimeBundleInfoTo(ArgumentMatchers.any(CloudRuntimeEventImpl.class)); }
@Test public void shouldConvertBPMNSignalReceivedEventToCloudBPMNSignalReceivedEvent() { BPMNSignalImpl signal = new BPMNSignalImpl(); signal.setProcessDefinitionId("procDefId"); signal.setProcessInstanceId("procInstId"); BPMNSignalReceivedEventImpl signalReceivedEvent = new BPMNSignalReceivedEventImpl(signal); CloudBPMNSignalReceivedEvent cloudEvent = converter.from(signalReceivedEvent); assertThat(cloudEvent.getEntity()).isEqualTo(signal); assertThat(cloudEvent.getProcessDefinitionId()).isEqualTo("procDefId"); assertThat(cloudEvent.getProcessInstanceId()).isEqualTo("procInstId"); verify(runtimeBundleInfoAppender).appendRuntimeBundleInfoTo(ArgumentMatchers.any(CloudRuntimeEventImpl.class)); }