ProcessInstanceBuilderImpl implements ProcessInstanceBuilder { public ProcessInstance create() { return runtimeService.createProcessInstance(this); } ProcessInstanceBuilderImpl(RuntimeServiceImpl runtimeService); ProcessInstanceBuilder processDefinitionId(String processDefinitionId); ProcessInstanceBuilder processDefinitionKey(String processDefinitionKey); ProcessInstanceBuilder messageName(String messageName); ProcessInstanceBuilder name(String processInstanceName); ProcessInstanceBuilder businessKey(String businessKey); ProcessInstanceBuilder tenantId(String tenantId); ProcessInstanceBuilder variables(Map<String, Object> variables); ProcessInstanceBuilder variable(String variableName, Object value); ProcessInstanceBuilder transientVariables(Map<String, Object> transientVariables); ProcessInstanceBuilder transientVariable(String variableName, Object value); boolean hasProcessDefinitionIdOrKey(); ProcessInstance start(); ProcessInstance create(); String getProcessDefinitionId(); String getProcessDefinitionKey(); String getMessageName(); String getProcessInstanceName(); String getBusinessKey(); String getTenantId(); Map<String, Object> getVariables(); Map<String, Object> getTransientVariables();  }
@Test public void create_shouldDelegateCreationToRuntimeService() { ProcessInstance processInstance = mock( ProcessInstance.class); given(runtimeService.createProcessInstance(processInstanceBuilder)).willReturn(processInstance); ProcessInstance createdProcess = processInstanceBuilder.create(); assertThat(createdProcess).isEqualTo(processInstance); }