/** Test of correct use of startProcess */
  @Test(expected = UnsatisfiedContextParameterException.class)
  public void testStartProcessValidationException() {
    expect(processFactory.createProcessModel(processName, processDefinitionName, contextParameters))
        .andReturn(mockProcessModel);
    expect(processDefinitionFactory.getProcessDefinition(processDefinitionName))
        .andReturn(mockProcessDefinition);

    replay(processFactory, processDefinitionFactory);
    final DefaultBusinessProcessService defaultService =
        new DefaultBusinessProcessService() {
          @Override
          protected void validateContext(
              final BusinessProcessModel processModel, final ProcessDefinition processDefinition) {
            assertEquals(
                "mockProcessModel not equals to processModel", mockProcessModel, processModel);
            assertEquals(
                "mockProcessDefinition not equals to processDefinition",
                mockProcessDefinition,
                processDefinition);
            throw new UnsatisfiedContextParameterException();
          }
        };
    defaultService.setProcessFactory(processFactory);
    defaultService.setProcessDefinitionFactory(processDefinitionFactory);
    defaultService.setModelService(modelService);
    defaultService.setTransactionTemplate(transactionTemplate);

    defaultService.startProcess(processName, processDefinitionName, contextParameters);
    verify(processFactory, processDefinitionFactory);
  }
  /** Test of correct use of startProcess */
  @Test
  public void testStartProcess() {
    expect(processFactory.createProcessModel(processName, processDefinitionName, contextParameters))
        .andReturn(mockProcessModel);
    expect(processDefinitionFactory.getProcessDefinition(processDefinitionName))
        .andReturn(mockProcessDefinition);

    modelService.save(mockProcessModel);

    mockProcessDefinition.start(mockProcessModel);

    replay(processFactory, processDefinitionFactory, modelService);
    final DefaultBusinessProcessService defaultService =
        new DefaultBusinessProcessService() {
          @Override
          protected void validateContext(
              final BusinessProcessModel processModel, final ProcessDefinition processDefinition) {
            assertEquals(
                "mockProcessModel not equals to processModel", mockProcessModel, processModel);
            assertEquals(
                "mockProcessDefinition not equals to processDefinition",
                mockProcessDefinition,
                processDefinition);
          }
        };
    defaultService.setProcessFactory(processFactory);
    defaultService.setProcessDefinitionFactory(processDefinitionFactory);
    defaultService.setModelService(modelService);
    defaultService.setTransactionTemplate(transactionTemplate);

    defaultService.startProcess(processName, processDefinitionName, contextParameters);
    verify(processFactory, processDefinitionFactory, modelService);
    assertEquals(
        "mockProcessModel.getState() not in RUNNING state",
        ProcessState.RUNNING,
        mockProcessModel.getState());
  }