Search in sources :

Example 6 with IJunction

use of com.archimatetool.model.IJunction in project archi by archimatetool.

the class ArchiLabelProviderTests method testGetRelationshipSentence.

@Test
public void testGetRelationshipSentence() {
    // Null object
    assertEquals("", ArchiLabelProvider.INSTANCE.getRelationshipSentence(null));
    IBusinessActor actor = IArchimateFactory.eINSTANCE.createBusinessActor();
    actor.setName("Fred");
    IBusinessRole role = IArchimateFactory.eINSTANCE.createBusinessRole();
    role.setName("Nobody");
    IArchimateRelationship relation = IArchimateFactory.eINSTANCE.createAssignmentRelationship();
    relation.setSource(actor);
    relation.setTarget(role);
    assertEquals("Fred is assigned to Nobody", ArchiLabelProvider.INSTANCE.getRelationshipSentence(relation));
    relation.setSource(role);
    relation.setTarget(actor);
    assertEquals("Nobody is assigned to Fred", ArchiLabelProvider.INSTANCE.getRelationshipSentence(relation));
    // Junctions
    IJunction j1 = IArchimateFactory.eINSTANCE.createJunction();
    j1.setName("Johnny");
    relation.setSource(j1);
    relation.setTarget(actor);
    assertEquals("Johnny connects to Fred", ArchiLabelProvider.INSTANCE.getRelationshipSentence(relation));
    relation.setSource(actor);
    relation.setTarget(j1);
    assertEquals("Fred connects to Johnny", ArchiLabelProvider.INSTANCE.getRelationshipSentence(relation));
}
Also used : IBusinessActor(com.archimatetool.model.IBusinessActor) IBusinessRole(com.archimatetool.model.IBusinessRole) IArchimateRelationship(com.archimatetool.model.IArchimateRelationship) IJunction(com.archimatetool.model.IJunction) Test(org.junit.Test)

Aggregations

IJunction (com.archimatetool.model.IJunction)6 IArchimateRelationship (com.archimatetool.model.IArchimateRelationship)3 IArchimateElement (com.archimatetool.model.IArchimateElement)2 Test (org.junit.Test)2 IGraphicalObjectUIProvider (com.archimatetool.editor.ui.factory.IGraphicalObjectUIProvider)1 ErrorType (com.archimatetool.hammer.validation.issues.ErrorType)1 IIssue (com.archimatetool.hammer.validation.issues.IIssue)1 IAccessRelationship (com.archimatetool.model.IAccessRelationship)1 IAggregationRelationship (com.archimatetool.model.IAggregationRelationship)1 IAssignmentRelationship (com.archimatetool.model.IAssignmentRelationship)1 IBounds (com.archimatetool.model.IBounds)1 IBusinessActor (com.archimatetool.model.IBusinessActor)1 IBusinessRole (com.archimatetool.model.IBusinessRole)1 ICompositionRelationship (com.archimatetool.model.ICompositionRelationship)1 IDiagramModelArchimateObject (com.archimatetool.model.IDiagramModelArchimateObject)1 IRealizationRelationship (com.archimatetool.model.IRealizationRelationship)1 ISpecializationRelationship (com.archimatetool.model.ISpecializationRelationship)1 ArrayList (java.util.ArrayList)1 Dimension (org.eclipse.draw2d.geometry.Dimension)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1