public void testConstructorName() throws Exception { CtClass cc = sloader.get("test2.Construct"); CtConstructor[] cons = cc.getDeclaredConstructors(); assertEquals("Construct", cons[0].getName()); assertEquals("Construct", cons[1].getName()); assertEquals("<clinit>", cc.getClassInitializer().getName()); }
public void testWhere() throws Exception { CtClass cc = sloader.get("test2.Where"); CtConstructor cons = cc.getClassInitializer(); cons.instrument( new ExprEditor() { public void edit(MethodCall m) throws CannotCompileException { System.out.println(m.where().getName()); } }); }