@Test void testDeleteAllStream() { Object entityId = mock(Object.class); Stream<Object> entityIdStream = Stream.of(entityId); Stream<Object> validatedEntityIdStream = Stream.of(entityId); when(defaultValueReferenceValidator.validateEntitiesNotReferencedById( entityIdStream, entityType)) .thenReturn(validatedEntityIdStream); repositoryValidationDecorator.deleteAll(entityIdStream); @SuppressWarnings("unchecked") ArgumentCaptor<Stream<Object>> captor = ArgumentCaptor.forClass(Stream.class); verify(delegateRepository).deleteAll(captor.capture()); verify(defaultValueReferenceValidator) .validateEntitiesNotReferencedById(entityIdStream, entityType); assertEquals(singletonList(entityId), captor.getValue().collect(toList())); }
@Override public void deleteAll() { defaultValueReferenceValidator.validateEntityTypeNotReferenced(getEntityType()); delegate().deleteAll(); }
RepositoryValidationDecorator extends AbstractRepositoryDecorator<Entity> { @Override public void deleteAll() { defaultValueReferenceValidator.validateEntityTypeNotReferenced(getEntityType()); delegate().deleteAll(); } }
RepositoryValidationDecorator extends AbstractRepositoryDecorator<Entity> { @Override public void deleteAll() { defaultValueReferenceValidator.validateEntityTypeNotReferenced(getEntityType()); delegate().deleteAll(); } RepositoryValidationDecorator(
      DataService dataService,
      Repository<Entity> delegateRepository,
      EntityAttributesValidator entityAttributesValidator,
      DefaultValueReferenceValidator defaultValueReferenceValidator); }
RepositoryValidationDecorator extends AbstractRepositoryDecorator<Entity> { @Override public void deleteAll() { defaultValueReferenceValidator.validateEntityTypeNotReferenced(getEntityType()); delegate().deleteAll(); } RepositoryValidationDecorator(
      DataService dataService,
      Repository<Entity> delegateRepository,
      EntityAttributesValidator entityAttributesValidator,
      DefaultValueReferenceValidator defaultValueReferenceValidator); @Override void update(Entity entity); @Override void update(Stream<Entity> entities); @Override void add(Entity entity); @Override Integer add(Stream<Entity> entities); @Override void delete(Entity entity); @Override void deleteById(Object id); @Override void deleteAll(); @Override void delete(Stream<Entity> entities); @Override void deleteAll(Stream<Object> ids); }
RepositoryValidationDecorator extends AbstractRepositoryDecorator<Entity> { @Override public void deleteAll() { defaultValueReferenceValidator.validateEntityTypeNotReferenced(getEntityType()); delegate().deleteAll(); } RepositoryValidationDecorator(
      DataService dataService,
      Repository<Entity> delegateRepository,
      EntityAttributesValidator entityAttributesValidator,
      DefaultValueReferenceValidator defaultValueReferenceValidator); @Override void update(Entity entity); @Override void update(Stream<Entity> entities); @Override void add(Entity entity); @Override Integer add(Stream<Entity> entities); @Override void delete(Entity entity); @Override void deleteById(Object id); @Override void deleteAll(); @Override void delete(Stream<Entity> entities); @Override void deleteAll(Stream<Object> ids);  }