### Question:
BackgroundJobManager { public <T> void submit(final BackgroundJob<T> job) { final long id = lastId.incrementAndGet(); final UUID uuid = UUID.randomUUID(); job.setId(id); job.setUUID(uuid); final Future<T> future = service.submit(job); job.setFuture(future); jobHistoryMap.put(uuid, job); if (jobInfoStore != null) { jobInfoStore.updateJobInfo(uuid, job.getJobInfo()); } LOGGER.info("a background job was submitted : id=" + id + " uuid=" + uuid + " title=" + job.getTitle()); } BackgroundJobManager();  BackgroundJobManager(final ThreadPoolExecutor executor); @Autowired(required = false) void setJobInfoStore(final JobInfoStore jobInfoStore); void submit(final BackgroundJob<T> job); List<BackgroundJob<?>> getRecentJobs(); @CheckForNull BackgroundJob<?> getJobForId(final UUID id); @Nullable BackgroundJob.JobInfo getJobInfo(final UUID jobId);  }### Answer:
@Test public void submit() { assertThat(manager.getRecentJobs()).isEmpty(); manager.scheduledCacheUpdate(); verify(infoStoreMock, never()).shouldUpdateJobInfo(any(BackgroundJob.class)); final BackgroundJob<?> job = mockBackgroundJob(); manager.submit(job); assertThat(manager.getRecentJobs()).containsExactly(job); when(infoStoreMock.shouldUpdateJobInfo(isA(BackgroundJob.class))).thenReturn(true); manager.scheduledCacheUpdate(); verify(infoStoreMock, times(1)).shouldUpdateJobInfo(job); verify(infoStoreMock, times(2)).updateJobInfo(any(UUID.class), any(BackgroundJob.JobInfo.class)); }