@Test public void shouldSaveNewServiceType() throws Exception { ServiceType type = new ServiceType(); service.save(type); verify(repository).insert(type); verify(repository, never()).update(any(ServiceType.class)); }
public void save(ServiceType serviceType){ if(serviceType.getId() == null){ repository.insert(serviceType); }else{ repository.update(serviceType); } }
ServiceTypeService { public void save(ServiceType serviceType){ if(serviceType.getId() == null){ repository.insert(serviceType); }else{ repository.update(serviceType); } } }
ServiceTypeService { public void save(ServiceType serviceType){ if(serviceType.getId() == null){ repository.insert(serviceType); }else{ repository.update(serviceType); } }  }
ServiceTypeService { public void save(ServiceType serviceType){ if(serviceType.getId() == null){ repository.insert(serviceType); }else{ repository.update(serviceType); } }  List<ServiceType> getAll(); ServiceType getById(Long id); void save(ServiceType serviceType); }
ServiceTypeService { public void save(ServiceType serviceType){ if(serviceType.getId() == null){ repository.insert(serviceType); }else{ repository.update(serviceType); } }  List<ServiceType> getAll(); ServiceType getById(Long id); void save(ServiceType serviceType);  }