@Test void testUniqueLabel() { ignoreMetadataCopyResult(); EntityType entityType = mockEntityType("A"); Package targetPackage = mock(Package.class); EntityType entityTypeInTarget = mock(EntityType.class); when(targetPackage.getEntityTypes()).thenReturn(singletonList(entityTypeInTarget)); when(entityTypeInTarget.getLabel()).thenReturn("A"); CopyState state = CopyState.create(targetPackage, mock(Progress.class)); copier.copy(singletonList(entityType), state); verify(entityType).setLabel("A (Copy)"); }
public void copy(List<EntityType> entityTypes, CopyState state) { List<EntityType> preparedEntityTypes = prepareEntityTypes(entityTypes, state); List<EntityType> copiedEntityTypes = copyEntityTypes(preparedEntityTypes, state); persist(copiedEntityTypes, state); }
EntityTypeCopier { public void copy(List<EntityType> entityTypes, CopyState state) { List<EntityType> preparedEntityTypes = prepareEntityTypes(entityTypes, state); List<EntityType> copiedEntityTypes = copyEntityTypes(preparedEntityTypes, state); persist(copiedEntityTypes, state); } }
EntityTypeCopier { public void copy(List<EntityType> entityTypes, CopyState state) { List<EntityType> preparedEntityTypes = prepareEntityTypes(entityTypes, state); List<EntityType> copiedEntityTypes = copyEntityTypes(preparedEntityTypes, state); persist(copiedEntityTypes, state); } EntityTypeCopier(
      DataService dataService,
      IdGenerator idGenerator,
      EntityTypeDependencyResolver entityTypeDependencyResolver,
      EntityTypeMetadataCopier entityTypeMetadataCopier); }
EntityTypeCopier { public void copy(List<EntityType> entityTypes, CopyState state) { List<EntityType> preparedEntityTypes = prepareEntityTypes(entityTypes, state); List<EntityType> copiedEntityTypes = copyEntityTypes(preparedEntityTypes, state); persist(copiedEntityTypes, state); } EntityTypeCopier(
      DataService dataService,
      IdGenerator idGenerator,
      EntityTypeDependencyResolver entityTypeDependencyResolver,
      EntityTypeMetadataCopier entityTypeMetadataCopier); void copy(List<EntityType> entityTypes, CopyState state); }
EntityTypeCopier { public void copy(List<EntityType> entityTypes, CopyState state) { List<EntityType> preparedEntityTypes = prepareEntityTypes(entityTypes, state); List<EntityType> copiedEntityTypes = copyEntityTypes(preparedEntityTypes, state); persist(copiedEntityTypes, state); } EntityTypeCopier(
      DataService dataService,
      IdGenerator idGenerator,
      EntityTypeDependencyResolver entityTypeDependencyResolver,
      EntityTypeMetadataCopier entityTypeMetadataCopier); void copy(List<EntityType> entityTypes, CopyState state);  }