public void testNewAttributeOK_03() { doTestContextOK("context Film def: newAttr : Integer = 10 def: newAttr2 : Boolean = true", getCurrentMethodName()); CoreClassifier film = (CoreClassifier)environment.lookup("Film"); Assert.IsNotNull((CoreAttribute)film.lookupAttribute("newAttr")); OclDeriveConstraint constraint = (OclDeriveConstraint)film.getDeriveConstraint("newAttr"); Assert.IsNotNull(constraint); Assert.AreEqual("Integer", ((ExpressionInOclImpl)constraint.getExpression()).getBodyExpression().getType().getName()); Assert.IsNotNull((CoreAttribute)film.lookupAttribute("newAttr2")); constraint = (OclDeriveConstraint)film.getDeriveConstraint("newAttr2"); Assert.IsNotNull(constraint); Assert.AreEqual("Boolean", ((ExpressionInOclImpl)constraint.getExpression()).getBodyExpression().getType().getName()); }
public void testNewAttribute_01() { doTestManyContextOK("context Film def: newAttr : Integer = 10 context SpecialFilm inv: newAttr > 10", getCurrentMethodName()); CoreClassifier film = (CoreClassifier)environment.lookup("Film"); OclDeriveConstraint constraint = (OclDeriveConstraint)film.getDeriveConstraint("newAttr"); Assert.IsNotNull(constraint); Assert.AreEqual("Integer", ((ExpressionInOclImpl)constraint.getExpression()).getBodyExpression().getType().getName()); }