JobDaoImpl implements JobDao, HasIntCrud<Job> { @Override public Job update(@Nonnull final Job job) { return genericDao.update(job); } @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 update() { Job job = createStandardJob(); int version = job.getVersion(); job.setName("Different name"); job.setEnabled(false); Job updatedJob = dao.update(job); assertThat(updatedJob.getId()).isEqualTo(job.getId()); assertThat(updatedJob.getVersion()).isEqualTo(version + 1); assertThat(updatedJob.getName()).isEqualTo("Different name"); assertThat(updatedJob.isEnabled()).isFalse(); Job fetchedUpdatedJob = dao.fetch(updatedJob.getId()).get(); assertThat(fetchedUpdatedJob.getId()).isEqualTo(job.getId()); assertThat(fetchedUpdatedJob.getVersion()).isEqualTo(version + 1); assertThat(fetchedUpdatedJob.getName()).isEqualTo("Different name"); assertThat(fetchedUpdatedJob.isEnabled()).isFalse(); }