public void testInterTypeMemberDeclares() { IProgramElement node = model.getRoot(); assertNotNull(node); IProgramElement aspect = model.findElementForType(null, "InterTypeDecCoverage"); assertNotNull(aspect); String fieldMsg = "Point.xxx"; IProgramElement fieldNode = model.findElementForLabel(aspect, IProgramElement.Kind.INTER_TYPE_FIELD, fieldMsg); assertNotNull(fieldNode); assertEquals(fieldNode.toLabelString(), fieldMsg); String methodMsg = "Point.check(int,Line)"; IProgramElement methodNode = model.findElementForLabel(aspect, IProgramElement.Kind.INTER_TYPE_METHOD, methodMsg); assertNotNull(methodNode); assertEquals(methodNode.toLabelString(), methodMsg); // TODO: enable // String constructorMsg = "Point.new(int, int, int)"; // ProgramElementNode constructorNode = model.findNode(aspect, // ProgramElementNode.Kind.INTER_TYPE_CONSTRUCTOR, // constructorMsg); // assertNotNull(constructorNode); // assertEquals(constructorNode.toLabelString(), constructorMsg); }
public void testAdvice() { IProgramElement node = model.getRoot(); assertNotNull(node); IProgramElement aspect = model.findElementForType(null, "AdviceNamingCoverage"); assertNotNull(aspect); String anon = "before(): <anonymous pointcut>"; IProgramElement anonNode = model.findElementForLabel(aspect, IProgramElement.Kind.ADVICE, anon); assertNotNull(anonNode); assertEquals(anonNode.toLabelString(), anon); String named = "before(): named.."; IProgramElement namedNode = model.findElementForLabel(aspect, IProgramElement.Kind.ADVICE, named); assertNotNull(namedNode); assertEquals(namedNode.toLabelString(), named); String namedWithOneArg = "around(int): namedWithOneArg.."; IProgramElement namedWithOneArgNode = model.findElementForLabel(aspect, IProgramElement.Kind.ADVICE, namedWithOneArg); assertNotNull(namedWithOneArgNode); assertEquals(namedWithOneArgNode.toLabelString(), namedWithOneArg); String afterReturning = "afterReturning(int,int): namedWithArgs.."; IProgramElement afterReturningNode = model.findElementForLabel(aspect, IProgramElement.Kind.ADVICE, afterReturning); assertNotNull(afterReturningNode); assertEquals(afterReturningNode.toLabelString(), afterReturning); String around = "around(int): namedWithOneArg.."; IProgramElement aroundNode = model.findElementForLabel(aspect, IProgramElement.Kind.ADVICE, around); assertNotNull(aroundNode); assertEquals(aroundNode.toLabelString(), around); String compAnon = "before(int): <anonymous pointcut>.."; IProgramElement compAnonNode = model.findElementForLabel(aspect, IProgramElement.Kind.ADVICE, compAnon); assertNotNull(compAnonNode); assertEquals(compAnonNode.toLabelString(), compAnon); String compNamed = "before(int): named().."; IProgramElement compNamedNode = model.findElementForLabel(aspect, IProgramElement.Kind.ADVICE, compNamed); assertNotNull(compNamedNode); assertEquals(compNamedNode.toLabelString(), compNamed); }