### Question:
ProducerManager { public void deregister(final String jobName) { Optional<CloudJobConfiguration> jobConfig = configService.load(jobName); if (jobConfig.isPresent()) { disableJobService.remove(jobName); configService.remove(jobName); } unschedule(jobName); } 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 public void assertDeregisterNotExisted() { when(configService.load("transient_test_job")).thenReturn(Optional.<CloudJobConfiguration>absent()); producerManager.deregister("transient_test_job"); verify(configService, times(0)).remove("transient_test_job"); }
@Test public void assertDeregisterExisted() { 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.deregister("transient_test_job"); for (TaskContext each : taskContexts) { verify(schedulerDriver).killTask(Protos.TaskID.newBuilder().setValue(each.getId()).build()); } verify(disableJobService).remove("transient_test_job"); verify(configService).remove("transient_test_job"); verify(runningService).remove("transient_test_job"); verify(readyService).remove(Lists.newArrayList("transient_test_job")); }