JobDaoImpl implements JobDao, HasIntCrud<Job> { @Override public Optional<Job> fetch(int id) { return genericDao.fetch(id); } @Inject  JobDaoImpl(final JobDbConnProvider jobDbConnProvider); @Override Job create(@Nonnull final Job job); @Override Job update(@Nonnull final Job job); @Override boolean delete(int id); @Override Optional<Job> fetch(int id); @Override ResultPage<Job> find(FindJobCriteria criteria); @Override int deleteOrphans();  }
@Test void basicCreation() { Job job = createStandardJob(); assertThat(job.getId()).isNotNull(); assertThat(job.getVersion()).isNotNull(); assertThat(job.getName()).isEqualTo("Some name"); assertThat(job.isEnabled()).isTrue(); Job loadedJob = dao.fetch(job.getId()).get(); assertThat(loadedJob.getId()).isEqualTo(job.getId()); assertThat(loadedJob.getVersion()).isNotNull(); assertThat(loadedJob.getName()).isEqualTo("Some name"); assertThat(loadedJob.isEnabled()).isTrue(); }
@Test void badFetch() { Optional<Job> job = dao.fetch(11111); assertThat(job.isPresent()).isFalse(); }