public AssociationClass getAssociationClass() { Element owner = this.property.getOwner(); if (owner instanceof AssociationClass) { return (AssociationClass) owner; } else if (owner instanceof Class) { Class ownerClass = (Class) owner; List<Association> associations = ownerClass.getAssociations(); for (Association association : associations) { List<Property> memberEnds = association.getMemberEnds(); for (Property p : memberEnds) { if (p == this.property && (association instanceof AssociationClass)) { return (AssociationClass) association; } } } return null; } return null; }
public boolean isMemberOfAssociationClass() { Element owner = this.property.getOwner(); if (owner instanceof AssociationClass) { AssociationClass ownerClass = (AssociationClass) owner; List<Property> memberEnds = ownerClass.getMemberEnds(); for (Property p : memberEnds) { if (p == this.property) { return true; } } return false; } else if (owner instanceof Class) { Class ownerClass = (Class) owner; List<Association> associations = ownerClass.getAssociations(); for (Association association : associations) { List<Property> memberEnds = association.getMemberEnds(); for (Property p : memberEnds) { if (p == this.property && (association instanceof AssociationClass)) { return true; } } } return false; } return false; }
public void setUpMocks() throws Exception { String fullQualifiedName = "de::crowdcode::kissmda::testapp::components::Company"; clazz = mock(Class.class); when(clazz.getQualifiedName()).thenReturn(fullQualifiedName); when(clazz.getName()).thenReturn("Company"); when(clazz.getAssociations()) .thenReturn(new UniqueEList<Association>()); when(clazz.getImplementedInterfaces()).thenReturn( new UniqueEList<Interface>()); }
public void setUpMocks() throws Exception { String fullQualifiedName = "de::crowdcode::kissmda::testapp::components::CompanyException"; clazz = mock(Class.class); when(clazz.getQualifiedName()).thenReturn(fullQualifiedName); when(clazz.getName()).thenReturn("CompanyException"); when(clazz.getAssociations()) .thenReturn(new UniqueEList<Association>()); when(clazz.getImplementedInterfaces()).thenReturn( new UniqueEList<Interface>()); when(clazz.getGeneralizations()).thenReturn( new UniqueEList<Generalization>()); }
public void setUpMocks() throws Exception { String fullQualifiedName = "de::crowdcode::kissmda::testapp::components::Company"; clazz = mock(Class.class); when(clazz.getQualifiedName()).thenReturn(fullQualifiedName); when(clazz.getName()).thenReturn("Company"); when(clazz.getAssociations()) .thenReturn(new UniqueEList<Association>()); when(clazz.getImplementedInterfaces()).thenReturn( new UniqueEList<Interface>()); when(clazz.getGeneralizations()).thenReturn( new UniqueEList<Generalization>()); when(clazz.getOwnedComments()).thenReturn(new UniqueEList<Comment>()); }