@Test
  public void businessProcessShouldPickUpLatestProcessDefinition() throws InterruptedException {
    final ActionsJournal journal = Registry.getApplicationContext().getBean(ActionsJournal.class);
    givenUpdatedProcessDefinition();

    final BusinessProcessModel businessProcess =
        businessProcessService.startProcess(TEST_PROCESS_CODE, TEST_DEFINITION_CODE);
    waitFor(businessProcess);

    assertThat(businessProcess.getProcessDefinitionName()).isEqualTo(TEST_DEFINITION_CODE);
    assertThat(businessProcess.getProcessDefinitionVersion())
        .isNotNull()
        .isEqualTo(Long.toString(1L));
    journal.verify(businessProcess.getCode(), PROCEDURAL_ACTION_ID, UPDATED_NUMBER_OF_NODES);
  }
  @Test
  public void runningBusinessProcessShouldFinishWithOldProcessDefinition()
      throws InterruptedException {
    final ActionsJournal journal = Registry.getApplicationContext().getBean(ActionsJournal.class);
    final DynamicProcessDefinitionModel initialProcessDefinition = givenInitialProcessDefinition();

    final BusinessProcessModel businessProcess =
        businessProcessService.createProcess(TEST_PROCESS_CODE, TEST_DEFINITION_CODE);
    businessProcessService.startProcess(businessProcess);
    final DynamicProcessDefinitionModel latestProcessDefinition =
        givenUpdatedProcessDefinitionOf(initialProcessDefinition);
    waitFor(businessProcess);

    assertThat(businessProcess.getProcessDefinitionName()).isEqualTo(TEST_DEFINITION_CODE);
    assertThat(businessProcess.getProcessDefinitionVersion())
        .isNotNull()
        .isNotEqualTo(latestProcessDefinition.getChecksum());
    journal.verify(businessProcess.getCode(), PROCEDURAL_ACTION_ID, INITIAL_NUMBER_OF_NODES);
  }