@Test public void shouldCreateFacilityVisitIfIdNotPresent() { FacilityVisit facilityVisit = new FacilityVisit(); FacilityVisit returnedFacilityVisit = facilityVisitRepository.save(facilityVisit); verify(facilityVisitMapper).insert(facilityVisit); assertThat(returnedFacilityVisit, is(facilityVisit)); }
public FacilityVisit save(FacilityVisit facilityVisit) { if (facilityVisit.getId() == null) { mapper.insert(facilityVisit); } else { mapper.update(facilityVisit); } return facilityVisit; }
FacilityVisitRepository { public FacilityVisit save(FacilityVisit facilityVisit) { if (facilityVisit.getId() == null) { mapper.insert(facilityVisit); } else { mapper.update(facilityVisit); } return facilityVisit; } }
FacilityVisitRepository { public FacilityVisit save(FacilityVisit facilityVisit) { if (facilityVisit.getId() == null) { mapper.insert(facilityVisit); } else { mapper.update(facilityVisit); } return facilityVisit; }  }
FacilityVisitRepository { public FacilityVisit save(FacilityVisit facilityVisit) { if (facilityVisit.getId() == null) { mapper.insert(facilityVisit); } else { mapper.update(facilityVisit); } return facilityVisit; }  FacilityVisit get(FacilityVisit facilityVisit); void update(FacilityVisit facilityVisit); FacilityVisit getById(Long facilityVisitId); FacilityVisit getBy(Long facilityId, Long distributionId); List<FacilityVisit> getUnSyncedFacilities(Long distributionId); Integer getUnsyncedFacilityCountForDistribution(Long distributionId); FacilityVisit save(FacilityVisit facilityVisit); }
FacilityVisitRepository { public FacilityVisit save(FacilityVisit facilityVisit) { if (facilityVisit.getId() == null) { mapper.insert(facilityVisit); } else { mapper.update(facilityVisit); } return facilityVisit; }  FacilityVisit get(FacilityVisit facilityVisit); void update(FacilityVisit facilityVisit); FacilityVisit getById(Long facilityVisitId); FacilityVisit getBy(Long facilityId, Long distributionId); List<FacilityVisit> getUnSyncedFacilities(Long distributionId); Integer getUnsyncedFacilityCountForDistribution(Long distributionId); FacilityVisit save(FacilityVisit facilityVisit);  }