use of org.molgenis.metadata.manager.model.EditorAttributeIdentifier in project molgenis by molgenis.
the class AttributeReferenceMapperTest method testToAttributeReference.
@Test
public void testToAttributeReference() {
String id = "id";
String label = "label";
EditorAttributeIdentifier editorAttributeIdentifier = EditorAttributeIdentifier.create(id, label);
Attribute attribute = attributeReferenceMapper.toAttributeReference(editorAttributeIdentifier);
assertEquals(attribute.getIdValue(), id);
}
use of org.molgenis.metadata.manager.model.EditorAttributeIdentifier in project molgenis by molgenis.
the class EntityTypeParentMapperTest method testToEntityTypeReference.
@Test
public void testToEntityTypeReference() {
String id = "id";
String label = "label";
@SuppressWarnings("unchecked") List<EditorAttributeIdentifier> attributes = mock(List.class);
EditorEntityTypeParent parent = mock(EditorEntityTypeParent.class);
EditorEntityTypeParent editorEntityTypeParent = EditorEntityTypeParent.create(id, label, attributes, parent);
EntityType entityType = entityTypeParentMapper.toEntityTypeReference(editorEntityTypeParent);
assertEquals(entityType.getIdValue(), id);
}
use of org.molgenis.metadata.manager.model.EditorAttributeIdentifier in project molgenis by molgenis.
the class AttributeReferenceMapperTest method testToEditorAttributeIdentifier.
@Test
public void testToEditorAttributeIdentifier() {
String id = "id";
String label = "label";
String entityTypeId = "id";
String entityTypeLabel = "label";
Attribute attribute = mock(Attribute.class);
EntityType entityType = mock(EntityType.class);
when(attribute.getIdentifier()).thenReturn(id);
when(attribute.getLabel()).thenReturn(label);
when(attribute.getEntity()).thenReturn(entityType);
when(entityType.getId()).thenReturn(entityTypeId);
when(entityType.getLabel()).thenReturn(entityTypeLabel);
EditorAttributeIdentifier editorAttributeIdentifier = attributeReferenceMapper.toEditorAttributeIdentifier(attribute);
EditorEntityTypeIdentifier editorEntityTypeIdentifier = EditorEntityTypeIdentifier.create(entityTypeId, entityTypeLabel);
assertEquals(editorAttributeIdentifier, EditorAttributeIdentifier.create(id, label, editorEntityTypeIdentifier));
}
use of org.molgenis.metadata.manager.model.EditorAttributeIdentifier in project molgenis by molgenis.
the class AttributeReferenceMapperTest method testToEditorAttributeIdentifiers.
@Test
public void testToEditorAttributeIdentifiers() {
String id = "id";
String label = "label";
String entityTypeId = "id";
String entityTypeLabel = "label";
Attribute attribute = mock(Attribute.class);
EntityType entityType = mock(EntityType.class);
when(attribute.getIdentifier()).thenReturn(id);
when(attribute.getLabel()).thenReturn(label);
when(attribute.getEntity()).thenReturn(entityType);
when(entityType.getId()).thenReturn(entityTypeId);
when(entityType.getLabel()).thenReturn(entityTypeLabel);
ImmutableList<EditorAttributeIdentifier> editorAttributeIdentifier = attributeReferenceMapper.toEditorAttributeIdentifiers(of(attribute));
EditorEntityTypeIdentifier editorEntityTypeIdentifier = EditorEntityTypeIdentifier.create(entityTypeId, entityTypeLabel);
assertEquals(editorAttributeIdentifier, of(EditorAttributeIdentifier.create(id, label, editorEntityTypeIdentifier)));
}
use of org.molgenis.metadata.manager.model.EditorAttributeIdentifier in project molgenis by molgenis.
the class EntityTypeParentMapperTest method testToEditorEntityTypeParent.
@Test
public 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(editorEntityTypeParent, expectedEditorEntityTypeParent);
}
Aggregations