@Test
  public void shouldGenerateIdsOnCreate() {
    BpmnModelInstance modelInstance = Bpmn.createEmptyModel();
    Definitions definitions = modelInstance.newInstance(Definitions.class);
    assertThat(definitions.getId()).isNotNull();

    Process process = modelInstance.newInstance(Process.class);
    assertThat(process.getId()).isNotNull();

    StartEvent startEvent = modelInstance.newInstance(StartEvent.class);
    assertThat(startEvent.getId()).isNotNull();

    UserTask userTask = modelInstance.newInstance(UserTask.class);
    assertThat(userTask.getId()).isNotNull();
  }
  @Test
  public void shouldNotGenerateIdsOnRead() {
    BpmnModelInstance modelInstance =
        Bpmn.readModelFromStream(GenerateIdTest.class.getResourceAsStream("GenerateIdTest.bpmn"));
    Definitions definitions = modelInstance.getDefinitions();
    assertThat(definitions.getId()).isNull();

    Process process = modelInstance.getModelElementsByType(Process.class).iterator().next();
    assertThat(process.getId()).isNull();

    StartEvent startEvent =
        modelInstance.getModelElementsByType(StartEvent.class).iterator().next();
    assertThat(startEvent.getId()).isNull();

    UserTask userTask = modelInstance.getModelElementsByType(UserTask.class).iterator().next();
    assertThat(userTask.getId()).isNull();
  }
 /**
  * Returns the name of the user task after the start event.
  *
  * @param modelInstance the BPMN model instance
  * @return the name attribute value of the user task
  */
 protected String getUserTaskName(BpmnModelInstance modelInstance) {
   StartEvent startEvent = getStartEvent(modelInstance);
   UserTask userTask = (UserTask) startEvent.getSucceedingNodes().singleResult();
   return stripLineBreaks(userTask.getName());
 }
 /**
  * Returns the name of the start event.
  *
  * @param modelInstance the BPMN model instance
  * @return the name attribute value of the start event
  */
 protected String getStartEventName(BpmnModelInstance modelInstance) {
   StartEvent startEvent = getStartEvent(modelInstance);
   return stripLineBreaks(startEvent.getName());
 }