@Test void testUpdateToGroupPackage() { Package existingNonGroupPackage = mockNonGroupPackage(); Package newGroupPackage = mockGroupPackage("test"); when(delegateRepository.findOneById("test")).thenReturn(existingNonGroupPackage); groupPackageRepositoryDecorator.update(newGroupPackage); assertAll( () -> verify(delegateRepository).update(newGroupPackage), () -> verify(groupPackageService).createGroup(newGroupPackage)); }
@Override public void update(Package aPackage) { Package currentPackage = getPackage(aPackage.getId()); validateUpdate(currentPackage, aPackage); super.update(aPackage); if (!isGroupPackage(currentPackage) && isGroupPackage(aPackage)) { groupPackageService.createGroup(aPackage); } }
GroupPackageRepositoryDecorator extends AbstractRepositoryDecorator<Package> { @Override public void update(Package aPackage) { Package currentPackage = getPackage(aPackage.getId()); validateUpdate(currentPackage, aPackage); super.update(aPackage); if (!isGroupPackage(currentPackage) && isGroupPackage(aPackage)) { groupPackageService.createGroup(aPackage); } } }
GroupPackageRepositoryDecorator extends AbstractRepositoryDecorator<Package> { @Override public void update(Package aPackage) { Package currentPackage = getPackage(aPackage.getId()); validateUpdate(currentPackage, aPackage); super.update(aPackage); if (!isGroupPackage(currentPackage) && isGroupPackage(aPackage)) { groupPackageService.createGroup(aPackage); } } GroupPackageRepositoryDecorator(
      Repository<Package> delegateRepository, GroupPackageService groupPackageService); }
GroupPackageRepositoryDecorator extends AbstractRepositoryDecorator<Package> { @Override public void update(Package aPackage) { Package currentPackage = getPackage(aPackage.getId()); validateUpdate(currentPackage, aPackage); super.update(aPackage); if (!isGroupPackage(currentPackage) && isGroupPackage(aPackage)) { groupPackageService.createGroup(aPackage); } } GroupPackageRepositoryDecorator(
      Repository<Package> delegateRepository, GroupPackageService groupPackageService); @Override void add(Package aPackage); @Override Integer add(Stream<Package> packageStream); @Override void update(Package aPackage); @Override void update(Stream<Package> packageStream); @Override void delete(Package aPackage); @Override void deleteById(Object id); @Override void deleteAll(); @Override void delete(Stream<Package> packages); @Override void deleteAll(Stream<Object> ids); }
GroupPackageRepositoryDecorator extends AbstractRepositoryDecorator<Package> { @Override public void update(Package aPackage) { Package currentPackage = getPackage(aPackage.getId()); validateUpdate(currentPackage, aPackage); super.update(aPackage); if (!isGroupPackage(currentPackage) && isGroupPackage(aPackage)) { groupPackageService.createGroup(aPackage); } } GroupPackageRepositoryDecorator(
      Repository<Package> delegateRepository, GroupPackageService groupPackageService); @Override void add(Package aPackage); @Override Integer add(Stream<Package> packageStream); @Override void update(Package aPackage); @Override void update(Stream<Package> packageStream); @Override void delete(Package aPackage); @Override void deleteById(Object id); @Override void deleteAll(); @Override void delete(Stream<Package> packages); @Override void deleteAll(Stream<Object> ids);  }