@Test
 public void postProcessWithTasks() throws Exception {
   final Process process = new Process("Process with tasks");
   int tasksCount = 10;
   createTasksForProcess(process, tasksCount);
   final ProcessDTO processDTO =
       client
           .target("http://localhost:" + RULE.getLocalPort() + "/processes")
           .request()
           .post(Entity.entity(process, APPLICATION_JSON_TYPE))
           .readEntity(ProcessDTO.class);
   // TODO check Response
   assertThat(processDTO.getId()).isNotNull();
   assertThat(processDTO.getName()).isEqualTo(process.getName());
   assertThat(processDTO.getTasks()).isNotEmpty();
   assertThat(processDTO.getTasks().size()).isEqualTo(tasksCount);
 }
  private void createTasksForProcess(Process process, int count) {
    for (long i = 1; i <= count; i++) {
      Task task = new Task("Task " + i);
      final TaskDTO taskDTO =
          client
              .target("http://localhost:" + RULE.getLocalPort() + "/tasks")
              .request()
              .post(Entity.entity(task, APPLICATION_JSON_TYPE))
              .readEntity(TaskDTO.class);

      ProcessTask assoc = new ProcessTask();
      task.setId(taskDTO.getId());
      assoc.setTask(task);
      assoc.setPosition(i);
      process.getTaskAssoc().add(assoc);
    }
  }