IScheduledTask oldTask1 = buildScheduledTask(0, 5);
IScheduledTask oldTask2 = buildScheduledTask(1, 5);
// Set instance count to 1 to generate empty desired state in diff.
IJobUpdate update = buildJobUpdate(1, newTask, ImmutableMap.of(
oldTask1.getAssignedTask().getTask(), ImmutableSet.of(new Range(0, 1))));
expect(quotaManager.checkJobUpdate(anyObject(IJobUpdate.class))).andReturn(ENOUGH_QUOTA);
// Set diff-adjusted IJobUpdate expectations.
JobUpdate expected = update.newBuilder();
expected.getInstructions().setInitialState(ImmutableSet.of(
new InstanceTaskConfig(newTask.newBuilder(), ImmutableSet.of(new Range(1, 1)))));
expected.getInstructions().unsetDesiredState();
expect(uuidGenerator.createNew()).andReturn(UU_ID);
storageUtil.expectTaskFetch(
Query.unscoped().byJob(JOB_KEY).active(),