@Test void addRemoveAttributeAbstractEntityType() { when(entityType1.getId()).thenReturn(entityTypeId1); when(entityType2.getId()).thenReturn(entityTypeId2); String entityTypeId3 = "EntityType3"; when(entityType3.getId()).thenReturn(entityTypeId3); when(dataService.getMeta()).thenReturn(metaDataService); EntityType currentEntityType = mock(EntityType.class); EntityType currentEntityType2 = mock(EntityType.class); EntityType currentEntityType3 = mock(EntityType.class); doReturn(currentEntityType).when(delegateRepository).findOneById(entityTypeId1); doReturn(currentEntityType2).when(delegateRepository).findOneById(entityTypeId2); doReturn(currentEntityType3).when(delegateRepository).findOneById(entityTypeId3); Attribute attributeStays = mock(Attribute.class); when(attributeStays.getName()).thenReturn("attributeStays"); Attribute attributeRemoved = mock(Attribute.class); when(attributeRemoved.getName()).thenReturn("attributeRemoved"); Attribute attributeAdded = mock(Attribute.class); when(attributeAdded.getName()).thenReturn("attributeAdded"); when(currentEntityType.isAbstract()).thenReturn(true); when(currentEntityType.getOwnAllAttributes()) .thenReturn(Lists.newArrayList(attributeStays, attributeRemoved)); when(entityType1.getOwnAllAttributes()) .thenReturn(Lists.newArrayList(attributeStays, attributeAdded)); when(metaDataService.getConcreteChildren(entityType1)) .thenReturn(Stream.of(entityType2, entityType3)); RepositoryCollection backend2 = mock(RepositoryCollection.class); RepositoryCollection backend3 = mock(RepositoryCollection.class); doReturn(backend2).when(metaDataService).getBackend(entityType2); doReturn(backend3).when(metaDataService).getBackend(entityType3); repo.update(entityType1); verify(backend2).addAttribute(currentEntityType2, attributeAdded); verify(backend2).deleteAttribute(currentEntityType2, attributeRemoved); verify(backend3).addAttribute(currentEntityType3, attributeAdded); verify(backend3).deleteAttribute(currentEntityType3, attributeRemoved); verify(backend2, never()).updateRepository(any(), any()); verify(backend3, never()).updateRepository(any(), any()); }
@Override public void update(EntityType entity) { updateEntity(entity); }
EntityTypeRepositoryDecorator extends AbstractRepositoryDecorator<EntityType> { @Override public void update(EntityType entity) { updateEntity(entity); } }
EntityTypeRepositoryDecorator extends AbstractRepositoryDecorator<EntityType> { @Override public void update(EntityType entity) { updateEntity(entity); } EntityTypeRepositoryDecorator(
      Repository<EntityType> delegateRepository,
      DataService dataService,
      EntityTypeDependencyResolver entityTypeDependencyResolver); }
EntityTypeRepositoryDecorator extends AbstractRepositoryDecorator<EntityType> { @Override public void update(EntityType entity) { updateEntity(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 update(EntityType entity) { updateEntity(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);  }