Source:
public void saveThenReloadDiseaseOccurrence() { Alert alert = createAlert(); Location location = new Location("Karachi", 25.0111455, 67.0647043, LocationPrecision.PRECISE); DiseaseGroup diseaseGroup = diseaseGroupDao.getById(1); DateTime occurrenceDate = DateTime.now().minusDays(5); double systemWeighting = 0.5; DiseaseOccurrence occurrence = new DiseaseOccurrence(); occurrence.setAlert(alert); occurrence.setLocation(location); occurrence.setDiseaseGroup(diseaseGroup); occurrence.setOccurrenceDate(occurrenceDate); occurrence.setMachineWeighting(systemWeighting); occurrence.setValidationWeighting(systemWeighting); diseaseOccurrenceDao.save(occurrence); assertThat(occurrence.getCreatedDate()).isNotNull(); assertThat(occurrence.getAlert()).isNotNull(); assertThat(occurrence.getAlert().getId()).isNotNull(); assertThat(occurrence.getAlert().getCreatedDate()).isNotNull(); assertThat(occurrence.getLocation()).isNotNull(); assertThat(occurrence.getLocation().getId()).isNotNull(); assertThat(occurrence.getLocation().getCreatedDate()).isNotNull(); Integer id = occurrence.getId(); flushAndClear(); occurrence = diseaseOccurrenceDao.getById(id); assertThat(occurrence.getAlert()).isNotNull(); assertThat(occurrence.getAlert().getId()).isNotNull(); assertThat(occurrence.getCreatedDate()).isNotNull(); assertThat(occurrence.getLocation()).isNotNull(); assertThat(occurrence.getLocation().getId()).isNotNull(); assertThat(occurrence.getValidationWeighting()).isEqualTo(systemWeighting); assertThat(occurrence.getDiseaseGroup()).isNotNull(); assertThat(occurrence.getDiseaseGroup().getId()).isNotNull(); assertThat(occurrence.getOccurrenceDate()).isEqualTo(occurrenceDate); }

Target:
public void saveThenReloadDiseaseOccurrence() { Alert alert = createAlert(); Location location = new Location("Karachi", 25.0111455, 67.0647043, LocationPrecision.PRECISE); DiseaseGroup diseaseGroup = diseaseGroupDao.getById(1); DateTime occurrenceDate = DateTime.now().minusDays(5); double machineWeighting = 0.5; DiseaseOccurrence occurrence = new DiseaseOccurrence(); occurrence.setAlert(alert); occurrence.setLocation(location); occurrence.setDiseaseGroup(diseaseGroup); occurrence.setOccurrenceDate(occurrenceDate); occurrence.setMachineWeighting(machineWeighting); occurrence.setValidationWeighting(machineWeighting); diseaseOccurrenceDao.save(occurrence); assertThat(occurrence.getCreatedDate()).isNotNull(); assertThat(occurrence.getAlert()).isNotNull(); assertThat(occurrence.getAlert().getId()).isNotNull(); assertThat(occurrence.getAlert().getCreatedDate()).isNotNull(); assertThat(occurrence.getLocation()).isNotNull(); assertThat(occurrence.getLocation().getId()).isNotNull(); assertThat(occurrence.getLocation().getCreatedDate()).isNotNull(); Integer id = occurrence.getId(); flushAndClear(); occurrence = diseaseOccurrenceDao.getById(id); assertThat(occurrence.getAlert()).isNotNull(); assertThat(occurrence.getAlert().getId()).isNotNull(); assertThat(occurrence.getCreatedDate()).isNotNull(); assertThat(occurrence.getLocation()).isNotNull(); assertThat(occurrence.getLocation().getId()).isNotNull(); assertThat(occurrence.getValidationWeighting()).isEqualTo(machineWeighting); assertThat(occurrence.getDiseaseGroup()).isNotNull(); assertThat(occurrence.getDiseaseGroup().getId()).isNotNull(); assertThat(occurrence.getOccurrenceDate()).isEqualTo(occurrenceDate); }