assertResponse(INVALID_REQUEST, thrift.createJob(job.newBuilder(), DEFAULT_LOCK, SESSION));
}
@Test
public void testCreateJobFailsTaskIdLength() throws Exception {
IJobConfiguration job = IJobConfiguration.build(makeJob());
SanitizedConfiguration sanitized = SanitizedConfiguration.fromUnsanitized(job);
expectAuth(ROLE, true);
lockManager.validateIfLocked(LOCK_KEY, Optional.<ILock>absent());
storageUtil.expectTaskFetch(Query.jobScoped(JOB_KEY).active());
expect(cronJobManager.hasJob(JOB_KEY)).andReturn(false);
expect(quotaManager.checkInstanceAddition(anyObject(ITaskConfig.class), anyInt()))
.andReturn(ENOUGH_QUOTA);
expect(taskIdGenerator.generate(sanitized.getJobConfig().getTaskConfig(), 1))
.andReturn(Strings.repeat("a", MAX_TASK_ID_LENGTH + 1));
control.replay();
assertResponse(INVALID_REQUEST, thrift.createJob(job.newBuilder(), DEFAULT_LOCK, SESSION));
}