@Test
  public void BGC_transfer() throws Exception {
    fakeSparService.add(OTHER_PERSONAL_IDENTIFIER, ADDRESS);

    Map<String, Object> properties = new HashMap<>();
    properties.put("personalIdentifier", OTHER_PERSONAL_IDENTIFIER);
    String ocr = "5450897";
    properties.put("ocr", ocr);

    runtimeService.startProcessInstanceByMessage("create-insurance", ocr, properties);

    when_all_jobs_within_X_days_are_executed(10);

    Execution execution =
        runtimeService
            .createExecutionQuery()
            .messageEventSubscriptionName("bgc")
            .processVariableValueEquals("ocr", ocr)
            .singleResult();

    assertThat(execution, notNullValue());

    Map<String, Object> eventProperties = new HashMap<String, Object>();
    properties.put("amount", 56000);
    runtimeService.messageEventReceived("bgc", execution.getId(), eventProperties);
  }
  @Test
  public void person_who_exists_in_SPAR() throws Exception {
    fakeSparService.add(EXISTING_PERSONAL_IDENTIFIER, ADDRESS);

    Map<String, Object> properties = new HashMap<>();
    properties.put("personalIdentifier", EXISTING_PERSONAL_IDENTIFIER);
    properties.put("ocr", OCR);

    runtimeService.startProcessInstanceByMessage("create-insurance", OCR, properties);

    when_all_jobs_within_X_days_are_executed(10);

    Optional<? extends Customer> customer = customerRepository.findBy(EXISTING_PERSONAL_IDENTIFIER);

    assertThat(customer, hasValue(hasAddress(ADDRESS)));

    List<? extends Insurance> insurances = insuranceRepository.findBy(customer.get());

    assertThat(insurances, hasSize(1));

    InsuranceNumber insuranceNumber = insurances.get(0).getInsuranceNumber();

    List<Message> messages = outbox.receivedAfter(Instant.now().minus(Duration.ofHours(1)));

    assertThat(messages, hasSize(1));
    String payload = messages.get(0).getPayload();
    assertThat(payload, isJson(withProperty("messageType", equalTo("\"insurance-created\""))));
    assertThat(
        payload,
        isJson(
            withProperty(
                "personalIdentifier",
                equalTo("\"" + EXISTING_PERSONAL_IDENTIFIER.getValue() + "\""))));
    assertThat(payload, isJson(withProperty("ocr", equalTo("\"" + OCR + "\""))));
    assertThat(
        payload,
        isJson(withProperty("insuranceNumber", equalTo(insuranceNumber.getValue().toString()))));
  }