Search in sources :

Example 1 with IBusinessRole

use of com.archimatetool.model.IBusinessRole 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

IArchimateRelationship (com.archimatetool.model.IArchimateRelationship)1 IBusinessActor (com.archimatetool.model.IBusinessActor)1 IBusinessRole (com.archimatetool.model.IBusinessRole)1 IJunction (com.archimatetool.model.IJunction)1 Test (org.junit.Test)1