/** Unnamed @Deployment annotations don't work with parameterized Unit tests */
  @Ignore
  @Test
  @Deployment
  public void ruleUsageExample() {
    RuntimeService runtimeService = engineRule.getRuntimeService();
    runtimeService.startProcessInstanceByKey("ruleUsage");

    TaskService taskService = engineRule.getTaskService();
    Task task = taskService.createTaskQuery().singleResult();
    assertEquals("My Task", task.getName());

    taskService.complete(task.getId());
    assertEquals(0, runtimeService.createProcessInstanceQuery().count());
  }
  public void createTask(TaskDto taskDto) {
    ProcessEngine engine = getProcessEngine();
    TaskService taskService = engine.getTaskService();

    Task newTask = taskService.newTask(taskDto.getId());
    taskDto.updateTask(newTask);

    try {
      taskService.saveTask(newTask);

    } catch (NotValidException e) {
      throw new InvalidRequestException(
          Status.BAD_REQUEST, e, "Could not save task: " + e.getMessage());
    }
  }
  @Test
  @Deployment(
      resources =
          "org/camunda/bpm/engine/test/standalone/testing/ProcessEngineRuleParameterizedJunit4Test.ruleUsageExample.bpmn20.xml")
  public void ruleUsageExampleWithNamedAnnotation() {
    RuntimeService runtimeService = engineRule.getRuntimeService();
    runtimeService.startProcessInstanceByKey("ruleUsage");

    TaskService taskService = engineRule.getTaskService();
    Task task = taskService.createTaskQuery().singleResult();
    assertEquals("My Task", task.getName());

    taskService.complete(task.getId());
    assertEquals(0, runtimeService.createProcessInstanceQuery().count());
  }
  @Test
  @Deployment(resources = {"invokeRestService.bpmn"})
  public void shouldPackForWork() {
    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("date", "2014-01-02");

    RuntimeService runtimeService = processEngineRule.getRuntimeService();
    TaskService taskService = processEngineRule.getTaskService();

    runtimeService.startProcessInstanceByKey("holiday", variables);

    Task task = taskService.createTaskQuery().singleResult();
    Assert.assertNotNull(task);
    assertEquals("Pack for work", task.getName());

    boolean isHoliday =
        Boolean.parseBoolean(taskService.getVariable(task.getId(), "isHoliday").toString());
    Assert.assertFalse(isHoliday);
  }