@Test public void shouldUpdateDeliveryZoneIfIdAlreadyExists() throws Exception { DeliveryZone zone = new DeliveryZone(); zone.setId(1l); service.save(zone); verify(repository).update(zone); }
public void save(DeliveryZone zone) { if (zone.getId() != null) repository.update(zone); else repository.insert(zone); }
DeliveryZoneService { public void save(DeliveryZone zone) { if (zone.getId() != null) repository.update(zone); else repository.insert(zone); } }
DeliveryZoneService { public void save(DeliveryZone zone) { if (zone.getId() != null) repository.update(zone); else repository.insert(zone); }  }
DeliveryZoneService { public void save(DeliveryZone zone) { if (zone.getId() != null) repository.update(zone); else repository.insert(zone); }  void save(DeliveryZone zone); DeliveryZone getByCode(String code); List<DeliveryZone> getByUserForRight(long userId, String rightName); List<Program> getActiveProgramsForDeliveryZone(long zoneId); DeliveryZone getById(Long id); List<DeliveryZone> getAll(); List<Program> getAllProgramsForDeliveryZone(Long zoneId); }
DeliveryZoneService { public void save(DeliveryZone zone) { if (zone.getId() != null) repository.update(zone); else repository.insert(zone); }  void save(DeliveryZone zone); DeliveryZone getByCode(String code); List<DeliveryZone> getByUserForRight(long userId, String rightName); List<Program> getActiveProgramsForDeliveryZone(long zoneId); DeliveryZone getById(Long id); List<DeliveryZone> getAll(); List<Program> getAllProgramsForDeliveryZone(Long zoneId);  }