@Test
public void testMoveTask() {

    JobStore store = getJobStore();
    store.init().await();
    Job<ServiceJobExt> jobFrom = createServiceJobObject();
    store.storeJob(jobFrom).await();
    Job<ServiceJobExt> jobTo = createServiceJobObject();
    store.storeJob(jobTo).await();
    Task task = createServiceTaskObject(jobFrom);
    store.storeTask(task).await();
    Job<ServiceJobExt> updatedFromJob = JobFunctions.incrementJobSize(jobFrom, -1);
    Job<ServiceJobExt> updatedToJob = JobFunctions.incrementJobSize(jobTo, 1);
    Task updatedTask = task.toBuilder().withJobId(updatedToJob.getId()).build();
    store.moveTask(updatedFromJob, updatedToJob, updatedTask).await();
    // Load jobFrom from store
    Job<?> jobFromLoaded = store.retrieveJob(jobFrom.getId()).toBlocking().first();
    assertThat(JobFunctions.getJobDesiredSize(jobFromLoaded)).isEqualTo(0);
    Pair<List<Task>, Integer> jobFromTasksLoaded = store.retrieveTasksForJob(jobFrom.getId()).toBlocking().first();
    assertThat(jobFromTasksLoaded.getLeft()).hasSize(0);
    // Load jobTo from store
    Job<?> jobToLoaded = store.retrieveJob(jobTo.getId()).toBlocking().first();
    assertThat(JobFunctions.getJobDesiredSize(jobToLoaded)).isEqualTo(2);
    Pair<List<Task>, Integer> jobToTasksLoaded = store.retrieveTasksForJob(jobTo.getId()).toBlocking().first();
    assertThat(jobToTasksLoaded.getLeft()).hasSize(1);
    jobToTasksLoaded.getLeft().forEach(t -> assertThat(t.getJobId()).isEqualTo(jobTo.getId()));
}