@Test public void shouldUpdateProductGroup() throws Exception { productGroup.setId(1L); service.save(productGroup); verify(repository).update(productGroup); }
public void save(ProductGroup productGroup) { if (productGroup.getId() == null) { repository.insert(productGroup); } repository.update(productGroup); }
ProductGroupService { public void save(ProductGroup productGroup) { if (productGroup.getId() == null) { repository.insert(productGroup); } repository.update(productGroup); } }
ProductGroupService { public void save(ProductGroup productGroup) { if (productGroup.getId() == null) { repository.insert(productGroup); } repository.update(productGroup); } @Autowired  ProductGroupService(ProductGroupRepository repository); }
ProductGroupService { public void save(ProductGroup productGroup) { if (productGroup.getId() == null) { repository.insert(productGroup); } repository.update(productGroup); } @Autowired  ProductGroupService(ProductGroupRepository repository); void save(ProductGroup productGroup); ProductGroup getByCode(String code); List<ProductGroup> getAll(); ProductGroup validateAndReturn(ProductGroup group); }
ProductGroupService { public void save(ProductGroup productGroup) { if (productGroup.getId() == null) { repository.insert(productGroup); } repository.update(productGroup); } @Autowired  ProductGroupService(ProductGroupRepository repository); void save(ProductGroup productGroup); ProductGroup getByCode(String code); List<ProductGroup> getAll(); ProductGroup validateAndReturn(ProductGroup group);  }