### Question:
ProducerManager { public void update(final CloudJobConfiguration jobConfig) { Optional<CloudJobConfiguration> jobConfigFromZk = configService.load(jobConfig.getJobName()); if (!jobConfigFromZk.isPresent()) { throw new JobConfigurationException("Cannot found job '%s', please register first.", jobConfig.getJobName()); } configService.update(jobConfig); reschedule(jobConfig.getJobName()); } ProducerManager(final SchedulerDriver schedulerDriver, final CoordinatorRegistryCenter regCenter); void startup(); void register(final CloudJobConfiguration jobConfig); void update(final CloudJobConfiguration jobConfig); void deregister(final String jobName); void schedule(final CloudJobConfiguration jobConfig); void unschedule(final String jobName); void reschedule(final String jobName); void sendFrameworkMessage(final ExecutorID executorId, final SlaveID slaveId, final byte[] data); void shutdown();  }### Answer:
@Test(expected = JobConfigurationException.class) public void assertUpdateNotExisted() { when(configService.load("transient_test_job")).thenReturn(Optional.<CloudJobConfiguration>absent()); producerManager.update(transientJobConfig); }
@Test public void assertUpdateExisted() { when(configService.load("transient_test_job")).thenReturn(Optional.of(transientJobConfig)); List<TaskContext> taskContexts = Arrays.asList( TaskContext.from("transient_test_job@-@0@-@READY@-@SLAVE-S0@-@UUID"), TaskContext.from("transient_test_job@-@1@-@READY@-@SLAVE-S0@-@UUID")); when(runningService.getRunningTasks("transient_test_job")).thenReturn(taskContexts); producerManager.update(transientJobConfig); verify(configService).update(transientJobConfig); for (TaskContext each : taskContexts) { verify(schedulerDriver).killTask(Protos.TaskID.newBuilder().setValue(each.getId()).build()); } verify(runningService).remove("transient_test_job"); verify(readyService).remove(Lists.newArrayList("transient_test_job")); }