### Question:
DepositSupervisor implements WorkerListener { public void start() { pipelineStatusFactory.setPipelineState(DepositPipelineState.starting); requeueAll(); LOG.info("Starting deposit checks and worker pool"); if (timer != null) { return; } timer = new Timer("DepositSupervisor " + id); timer.schedule(actionMonitoringTask, actionMonitorDelay, actionMonitorDelay); startWorkerPools(); pipelineStatusFactory.setPipelineState(DepositPipelineState.active); } DepositSupervisor(); net.greghaines.jesque.Config getJesqueConfig(); void setJesqueConfig(net.greghaines.jesque.Config jesqueConfig); int getCleanupDelaySeconds(); void setCleanupDelaySeconds(int cleanupDelaySeconds); int getUnavailableDelaySeconds(); void setUnavailableDelaySeconds(int unavailableDelaySeconds); @PostConstruct void init(); void start(); void stop(boolean stopNow); DepositStatusFactory getDepositStatusFactory(); void setDepositStatusFactory(DepositStatusFactory depositStatusFactory); JobStatusFactory getJobStatusFactory(); void setJobStatusFactory(JobStatusFactory jobStatusFactory); File getDepositsDirectory(); void setDepositsDirectory(File depositsDirectory); void setActionMonitorDelay(long monitorDelay); @PreDestroy void shutdown(); Job makeJob(@SuppressWarnings("rawtypes") Class jobClass,
            String depositUUID); @Override void onEvent(WorkerEvent event, Worker worker, String queue,
            Job job, Object runner, Object result, Throwable t);  }### Answer:
@DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) @Test public void startSupervisorWithRunningDeposit() throws Exception { PID depositPid = queueDeposit(true, DepositState.running); supervisor.start(); assertDepositAction(DepositAction.resume, depositPid); Thread.sleep(50l); assertDepositStatus(DepositState.queued, depositPid); assertDepositAction(null, depositPid); }
@DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) @Test public void startSupervisorWithQuietedDeposit() throws Exception { PID depositPid = queueDeposit(true, DepositState.quieted); supervisor.start(); assertDepositAction(DepositAction.resume, depositPid); Thread.sleep(50l); assertDepositStatus(DepositState.queued, depositPid); assertDepositAction(null, depositPid); }
@DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) @Test public void startSupervisorWithPausedDeposit() throws Exception { PID depositPid = queueDeposit(true, DepositState.paused); supervisor.start(); assertDepositAction(null, depositPid); Thread.sleep(50l); assertDepositStatus(DepositState.paused, depositPid); assertDepositAction(null, depositPid); }
@DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) @Test public void startSupervisorWithNewQueuedDeposit() throws Exception { PID depositPid = queueDeposit(true, DepositState.queued); supervisor.start(); assertDepositAction(DepositAction.register, depositPid); Thread.sleep(50l); assertDepositStatus(DepositState.queued, depositPid); assertDepositAction(null, depositPid); }