@Test void deleteEntityTypesWithOneToMany() { String backend = "backend"; when(entityType1.getId()).thenReturn(entityTypeId1); when(entityType1.getBackend()).thenReturn(backend); when(entityType2.getId()).thenReturn(entityTypeId2); when(entityType2.getBackend()).thenReturn(backend); when(dataService.getMeta()).thenReturn(metaDataService); when(metaDataService.getBackend(backend)).thenReturn(repositoryCollection); Attribute mappedByAttribute = mock(Attribute.class); when(mappedByAttribute.getEntity()).thenReturn(entityType2); when(entityType1.getMappedByAttributes()).thenReturn(Stream.of(mappedByAttribute)); when(entityType2.getMappedByAttributes()).thenReturn(Stream.empty()); when(entityTypeDependencyResolver.resolve(any())).thenReturn(asList(entityType1, entityType2)); InOrder repositoryCollectionInOrder = inOrder(repositoryCollection); InOrder decoratedRepoInOrder = inOrder(delegateRepository); repo.delete(Stream.of(entityType1, entityType2)); verify(dataService).delete(ATTRIBUTE_META_DATA, mappedByAttribute); repositoryCollectionInOrder.verify(repositoryCollection).deleteRepository(entityType2); repositoryCollectionInOrder.verify(repositoryCollection).deleteRepository(entityType1); decoratedRepoInOrder.verify(delegateRepository).delete(entityType2); decoratedRepoInOrder.verify(delegateRepository).delete(entityType1); }
@Override public void delete(EntityType entity) { deleteEntityType(entity); }
EntityTypeRepositoryDecorator extends AbstractRepositoryDecorator<EntityType> { @Override public void delete(EntityType entity) { deleteEntityType(entity); } }
EntityTypeRepositoryDecorator extends AbstractRepositoryDecorator<EntityType> { @Override public void delete(EntityType entity) { deleteEntityType(entity); } EntityTypeRepositoryDecorator(
      Repository<EntityType> delegateRepository,
      DataService dataService,
      EntityTypeDependencyResolver entityTypeDependencyResolver); }
EntityTypeRepositoryDecorator extends AbstractRepositoryDecorator<EntityType> { @Override public void delete(EntityType entity) { deleteEntityType(entity); } EntityTypeRepositoryDecorator(
      Repository<EntityType> delegateRepository,
      DataService dataService,
      EntityTypeDependencyResolver entityTypeDependencyResolver); @Override void update(EntityType entity); @Override void update(Stream<EntityType> entities); @Override void delete(EntityType entity); @Override void delete(Stream<EntityType> entities); @Override void deleteById(Object id); @Override void deleteAll(Stream<Object> ids); @Override void deleteAll(); @Override void add(EntityType entity); @Override Integer add(Stream<EntityType> entities); }
EntityTypeRepositoryDecorator extends AbstractRepositoryDecorator<EntityType> { @Override public void delete(EntityType entity) { deleteEntityType(entity); } EntityTypeRepositoryDecorator(
      Repository<EntityType> delegateRepository,
      DataService dataService,
      EntityTypeDependencyResolver entityTypeDependencyResolver); @Override void update(EntityType entity); @Override void update(Stream<EntityType> entities); @Override void delete(EntityType entity); @Override void delete(Stream<EntityType> entities); @Override void deleteById(Object id); @Override void deleteAll(Stream<Object> ids); @Override void deleteAll(); @Override void add(EntityType entity); @Override Integer add(Stream<EntityType> entities);  }