@Test
  public void testWorkflowInstance() {
    LocalDateTime now = new LocalDateTime();

    String workflowInstanceIdInternal = getWorkflowInstanceIdInternal();

    VariableInstance variableInstance = new VariableInstance();
    variableInstance.setId("v");
    variableInstance.setVariableId("vid");

    List<VariableInstance> variableInstances = new ArrayList<>();
    variableInstances.add(variableInstance);

    WorkflowInstance workflowInstance = new WorkflowInstance();
    workflowInstance.setId(new WorkflowInstanceId(workflowInstanceIdInternal));
    workflowInstance.setVariableInstances(variableInstances);
    workflowInstance.setStart(now);
    workflowInstance.setEnd(now);

    workflowInstance = serialize(workflowInstance);

    assertNotNull(workflowInstance);
    assertEquals(now, workflowInstance.getStart());
    assertEquals(now, workflowInstance.getEnd());
    variableInstance = workflowInstance.getVariableInstances().get(0);
    assertEquals("v", variableInstance.getId());
    assertEquals("vid", variableInstance.getVariableId());
  }
  protected VariableInstance serializeVariableInstance(Object value, DataType dataType) {
    VariableInstance variableInstance = new VariableInstance();
    variableInstance.setValue(value);
    variableInstance.setType(dataType);

    List<VariableInstance> variableInstances = new ArrayList<>();
    variableInstances.add(variableInstance);

    WorkflowInstance workflowInstance = new WorkflowInstance();
    workflowInstance.setVariableInstances(variableInstances);

    workflowInstance = serialize(workflowInstance);

    return workflowInstance.getVariableInstances().get(0);
  }