@Test public void testGetJobSpecDetailsByIdReturnsEmptyOptionalIfJobSpecIdDoesntExistInTheDir() throws IOException { final Path jobSpecsDir = createTmpDir(FilesystemJobSpecDAOTest.class); final FilesystemJobSpecDAO filesystemJobSpecDAO = new FilesystemJobSpecDAO(jobSpecsDir); final JobSpecId jobSpecId = new JobSpecId(generateRandomBase36String(10)); final Optional<JobSpecSummary> jobSpecDetailsResponse = filesystemJobSpecDAO.getJobSpecSummaryById(jobSpecId); assertThat(jobSpecDetailsResponse.isPresent()).isFalse(); }
@Override public Optional<JobSpecSummary> getJobSpecSummaryById(JobSpecId jobSpecId) { return getJobSpecById(jobSpecId).map(JobSpec::toSummary); }
FilesystemJobSpecDAO implements JobSpecDAO { @Override public Optional<JobSpecSummary> getJobSpecSummaryById(JobSpecId jobSpecId) { return getJobSpecById(jobSpecId).map(JobSpec::toSummary); } }
FilesystemJobSpecDAO implements JobSpecDAO { @Override public Optional<JobSpecSummary> getJobSpecSummaryById(JobSpecId jobSpecId) { return getJobSpecById(jobSpecId).map(JobSpec::toSummary); } FilesystemJobSpecDAO(Path jobSpecsDir); }
FilesystemJobSpecDAO implements JobSpecDAO { @Override public Optional<JobSpecSummary> getJobSpecSummaryById(JobSpecId jobSpecId) { return getJobSpecById(jobSpecId).map(JobSpec::toSummary); } FilesystemJobSpecDAO(Path jobSpecsDir); @Override Optional<JobSpec> getJobSpecById(JobSpecId jobSpecId); @Override Map<String, HealthCheck> getHealthChecks(); @Override Optional<JobSpecSummary> getJobSpecSummaryById(JobSpecId jobSpecId); @Override List<JobSpecSummary> getJobSpecSummaries(int pageSize, int page); @Override List<JobSpecSummary> getJobSpecSummaries(int pageSize, int page, String query); }
FilesystemJobSpecDAO implements JobSpecDAO { @Override public Optional<JobSpecSummary> getJobSpecSummaryById(JobSpecId jobSpecId) { return getJobSpecById(jobSpecId).map(JobSpec::toSummary); } FilesystemJobSpecDAO(Path jobSpecsDir); @Override Optional<JobSpec> getJobSpecById(JobSpecId jobSpecId); @Override Map<String, HealthCheck> getHealthChecks(); @Override Optional<JobSpecSummary> getJobSpecSummaryById(JobSpecId jobSpecId); @Override List<JobSpecSummary> getJobSpecSummaries(int pageSize, int page); @Override List<JobSpecSummary> getJobSpecSummaries(int pageSize, int page, String query);  }