@SuppressWarnings("unchecked") @Test void deleteStream() { Package groupPackage = mockGroupPackage("group"); Package nonGroupPackage = mockNonGroupPackage(); Stream<Package> packages = Stream.of(groupPackage, nonGroupPackage); groupPackageRepositoryDecorator.delete(packages); ArgumentCaptor<Stream<Package>> streamCaptor = ArgumentCaptor.forClass(Stream.class); assertAll( () -> verify(delegateRepository).delete(streamCaptor.capture()), () -> assertEquals( asList(groupPackage, nonGroupPackage), streamCaptor.getValue().collect(Collectors.toList())), () -> verify(groupPackageService).deleteGroup(groupPackage), () -> verifyNoMoreInteractions(groupPackageService)); }
@Override public void delete(Package aPackage) { if (isGroupPackage(aPackage)) { groupPackageService.deleteGroup(aPackage); } super.delete(aPackage); }
GroupPackageRepositoryDecorator extends AbstractRepositoryDecorator<Package> { @Override public void delete(Package aPackage) { if (isGroupPackage(aPackage)) { groupPackageService.deleteGroup(aPackage); } super.delete(aPackage); } }
GroupPackageRepositoryDecorator extends AbstractRepositoryDecorator<Package> { @Override public void delete(Package aPackage) { if (isGroupPackage(aPackage)) { groupPackageService.deleteGroup(aPackage); } super.delete(aPackage); } GroupPackageRepositoryDecorator(
      Repository<Package> delegateRepository, GroupPackageService groupPackageService); }
GroupPackageRepositoryDecorator extends AbstractRepositoryDecorator<Package> { @Override public void delete(Package aPackage) { if (isGroupPackage(aPackage)) { groupPackageService.deleteGroup(aPackage); } super.delete(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 delete(Package aPackage) { if (isGroupPackage(aPackage)) { groupPackageService.deleteGroup(aPackage); } super.delete(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);  }