@SuppressWarnings("unchecked") @Test void deleteAllStream() { Package groupPackage = mockGroupPackage("group"); when(delegateRepository.findOneById("group")).thenReturn(groupPackage); Package nonGroupPackage = mockNonGroupPackage(); when(delegateRepository.findOneById("nonGroup")).thenReturn(nonGroupPackage); Stream<Object> packageIds = Stream.of("group", "nonGroup"); groupPackageRepositoryDecorator.deleteAll(packageIds); ArgumentCaptor<Stream<Object>> streamCaptor = ArgumentCaptor.forClass(Stream.class); assertAll( () -> verify(delegateRepository).deleteAll(streamCaptor.capture()), () -> assertEquals( asList("group", "nonGroup"), streamCaptor.getValue().collect(Collectors.toList())), () -> verify(groupPackageService).deleteGroup(groupPackage), () -> verifyNoMoreInteractions(groupPackageService)); }
@Override public void deleteAll() { forEachBatched(packages -> delete(packages.stream()), BATCH_SIZE); }
GroupPackageRepositoryDecorator extends AbstractRepositoryDecorator<Package> { @Override public void deleteAll() { forEachBatched(packages -> delete(packages.stream()), BATCH_SIZE); } }
GroupPackageRepositoryDecorator extends AbstractRepositoryDecorator<Package> { @Override public void deleteAll() { forEachBatched(packages -> delete(packages.stream()), BATCH_SIZE); } GroupPackageRepositoryDecorator(
      Repository<Package> delegateRepository, GroupPackageService groupPackageService); }
GroupPackageRepositoryDecorator extends AbstractRepositoryDecorator<Package> { @Override public void deleteAll() { forEachBatched(packages -> delete(packages.stream()), BATCH_SIZE); } 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 deleteAll() { forEachBatched(packages -> delete(packages.stream()), BATCH_SIZE); } 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);  }