@Test void testToEditorEntityTypeParent() { String parentId = "parentId"; String parentLabel = "parentLabel"; EntityType parentEntityType = mock(EntityType.class); when(parentEntityType.getId()).thenReturn(parentId); when(parentEntityType.getLabel()).thenReturn(parentLabel); @SuppressWarnings("unchecked") Iterable<Attribute> parentAttributes = mock(Iterable.class); when(parentEntityType.getOwnAllAttributes()).thenReturn(parentAttributes); String id = "id"; String label = "label"; EntityType entityType = mock(EntityType.class); when(entityType.getId()).thenReturn(id); when(entityType.getLabel()).thenReturn(label); @SuppressWarnings("unchecked") Iterable<Attribute> attributes = mock(Iterable.class); when(entityType.getOwnAllAttributes()).thenReturn(attributes); when(entityType.getExtends()).thenReturn(parentEntityType); @SuppressWarnings("unchecked") ImmutableList<EditorAttributeIdentifier> editorAttributes = mock(ImmutableList.class); when(attributeReferenceMapper.toEditorAttributeIdentifiers(attributes)) .thenReturn(editorAttributes); @SuppressWarnings("unchecked") ImmutableList<EditorAttributeIdentifier> parentEditorAttributes = mock(ImmutableList.class); when(attributeReferenceMapper.toEditorAttributeIdentifiers(parentAttributes)) .thenReturn(parentEditorAttributes); EditorEntityTypeParent editorEntityTypeParent = entityTypeParentMapper.toEditorEntityTypeParent(entityType); EditorEntityTypeParent expectedEditorEntityTypeParent = EditorEntityTypeParent.create( id, label, editorAttributes, EditorEntityTypeParent.create(parentId, parentLabel, parentEditorAttributes, null)); assertEquals(expectedEditorEntityTypeParent, editorEntityTypeParent); }
EditorEntityTypeParent toEditorEntityTypeParent(EntityType entityType) { if (entityType == null) { return null; } String id = entityType.getId(); String label = entityType.getLabel(); ImmutableList<EditorAttributeIdentifier> attributes = attributeReferenceMapper.toEditorAttributeIdentifiers(entityType.getOwnAllAttributes()); EditorEntityTypeParent parent = toEditorEntityTypeParent(entityType.getExtends()); return EditorEntityTypeParent.create(id, label, attributes, parent); }
EntityTypeParentMapper { EditorEntityTypeParent toEditorEntityTypeParent(EntityType entityType) { if (entityType == null) { return null; } String id = entityType.getId(); String label = entityType.getLabel(); ImmutableList<EditorAttributeIdentifier> attributes = attributeReferenceMapper.toEditorAttributeIdentifiers(entityType.getOwnAllAttributes()); EditorEntityTypeParent parent = toEditorEntityTypeParent(entityType.getExtends()); return EditorEntityTypeParent.create(id, label, attributes, parent); } }
EntityTypeParentMapper { EditorEntityTypeParent toEditorEntityTypeParent(EntityType entityType) { if (entityType == null) { return null; } String id = entityType.getId(); String label = entityType.getLabel(); ImmutableList<EditorAttributeIdentifier> attributes = attributeReferenceMapper.toEditorAttributeIdentifiers(entityType.getOwnAllAttributes()); EditorEntityTypeParent parent = toEditorEntityTypeParent(entityType.getExtends()); return EditorEntityTypeParent.create(id, label, attributes, parent); } EntityTypeParentMapper(
      AttributeReferenceMapper attributeReferenceMapper,
      EntityTypeMetadata entityTypeMetadata,
      DataService dataService); }
EntityTypeParentMapper { EditorEntityTypeParent toEditorEntityTypeParent(EntityType entityType) { if (entityType == null) { return null; } String id = entityType.getId(); String label = entityType.getLabel(); ImmutableList<EditorAttributeIdentifier> attributes = attributeReferenceMapper.toEditorAttributeIdentifiers(entityType.getOwnAllAttributes()); EditorEntityTypeParent parent = toEditorEntityTypeParent(entityType.getExtends()); return EditorEntityTypeParent.create(id, label, attributes, parent); } EntityTypeParentMapper(
      AttributeReferenceMapper attributeReferenceMapper,
      EntityTypeMetadata entityTypeMetadata,
      DataService dataService);  }
EntityTypeParentMapper { EditorEntityTypeParent toEditorEntityTypeParent(EntityType entityType) { if (entityType == null) { return null; } String id = entityType.getId(); String label = entityType.getLabel(); ImmutableList<EditorAttributeIdentifier> attributes = attributeReferenceMapper.toEditorAttributeIdentifiers(entityType.getOwnAllAttributes()); EditorEntityTypeParent parent = toEditorEntityTypeParent(entityType.getExtends()); return EditorEntityTypeParent.create(id, label, attributes, parent); } EntityTypeParentMapper(
      AttributeReferenceMapper attributeReferenceMapper,
      EntityTypeMetadata entityTypeMetadata,
      DataService dataService);   }