@Transactional
public void canSaveTask() {
Task task = createValidTask();
taskElementDAO.save(task);
flushAndEvict(task);
TaskElement fromDB;
try {
fromDB = taskElementDAO.find(task.getId());
} catch (InstanceNotFoundException e) {
throw new RuntimeException(e);
}
assertThat(fromDB.getId(), equalTo(task.getId()));
assertThat(fromDB, instanceOf(Task.class));
checkProperties(task, fromDB);
HoursGroup reloaded = ((Task) fromDB).getHoursGroup();
assertThat(reloaded.getId(), equalTo(reloaded.getId()));
}