@Test public void shouldUpdate() throws Exception { VaccineDisease disease = make(a(VaccineDiseaseBuilder.defaultDisease)); disease.setId(20L); service.save(disease); verify(mapper).update(disease); verify(mapper, never()).insert(any(VaccineDisease.class)); }
public void save(VaccineDisease disease){ if(!disease.hasId()){ repository.insert(disease); }else { repository.update(disease); } }
DiseaseService { public void save(VaccineDisease disease){ if(!disease.hasId()){ repository.insert(disease); }else { repository.update(disease); } } }
DiseaseService { public void save(VaccineDisease disease){ if(!disease.hasId()){ repository.insert(disease); }else { repository.update(disease); } }  }
DiseaseService { public void save(VaccineDisease disease){ if(!disease.hasId()){ repository.insert(disease); }else { repository.update(disease); } }  List<VaccineDisease> getAll(); void save(VaccineDisease disease); VaccineDisease getById(Long id); }
DiseaseService { public void save(VaccineDisease disease){ if(!disease.hasId()){ repository.insert(disease); }else { repository.update(disease); } }  List<VaccineDisease> getAll(); void save(VaccineDisease disease); VaccineDisease getById(Long id);  }