protected AttributeCallExp checkAttributeCallExp(OclExpression oclExpression, String attName, String attType) { Assert.IsTrue(oclExpression is AttributeCallExp); AttributeCallExp attExp = (AttributeCallExp)oclExpression; Assert.AreEqual(attName, attExp.getReferredAttribute().getName()); Assert.AreEqual(attType, attExp.getType().getName()); return(attExp); }
public void testAttributeCall_Superclass_02() { List <object> constraints = doTestContextOK("context SpecialFilm inv: self.tapes[1].number > 10", getCurrentMethodName()); OclExpression oclExpression = getConstraintExpression(constraints); Assert.IsTrue(((OperationCallExp)oclExpression).getSource() is AttributeCallExp); AttributeCallExp exp = (AttributeCallExp)((OperationCallExp)oclExpression).getSource(); Assert.AreEqual("Tape", exp.getReferredAttribute().getFeatureOwner().getName()); Assert.AreEqual("number", exp.getReferredAttribute().getName()); Assert.AreEqual("Integer", exp.getType().getName()); }
public void testClassifierAttribute_01() { List <object> constraints = doTestContextOK("context Film inv: Rental::maxDaysToReturn > SpecialFilm::days", getCurrentMethodName()); OclExpression oclExpression = getConstraintExpression(constraints); Assert.IsTrue(((OperationCallExp)oclExpression).getSource() is AttributeCallExp); AttributeCallExp exp = (AttributeCallExp)((OperationCallExp)oclExpression).getSource(); Assert.AreEqual("Rental", exp.getReferredAttribute().getFeatureOwner().getName()); Assert.AreEqual("maxDaysToReturn", exp.getReferredAttribute().getName()); Assert.AreEqual("Integer", exp.getType().getName()); }
public void testAttributeCallExp() { AstOclModelElementFactory factory1 = AstOclModelElementFactoryManager.getInstance(umlModel.getOclPackage()); VariableDeclaration variable = factory1.createVariableDeclaration("abc", getClassifier("Film"), null); VariableExp source1 = factory1.createVariableExp(variable); VariableExp source2 = factory1.createVariableExp(variable); CoreAttribute attribute = getClassifier("Film").lookupAttribute("name"); AttributeCallExp exp1 = factory1.createAttributeCallExp(source1, attribute, false); AttributeCallExp exp2 = factory1.createAttributeCallExp(source2, attribute, true); Assert.AreEqual("abc.name", exp1.ToString()); Assert.AreEqual("String", exp1.getType().getName()); Assert.AreEqual("abc.name@pre", exp2.ToString()); Assert.AreEqual("String", exp2.getType().getName()); }