use of spoon.test.template.testclasses.NtonCodeTemplate in project spoon by INRIA.
the class TemplateTest method testSubstitutionInsertAllNtoN.
@Test
public void testSubstitutionInsertAllNtoN() {
Launcher spoon = new Launcher();
spoon.addTemplateResource(new FileSystemFile("./src/test/java/spoon/test/template/testclasses/NtonCodeTemplate.java"));
spoon.addInputResource("./src/test/java/spoon/test/template/testclasses/C.java");
spoon.buildModel();
Factory factory = spoon.getFactory();
CtClass<?> cclass = factory.Class().get("spoon.test.template.testclasses.C");
new NtonCodeTemplate(cclass.getReference(), 5).apply(cclass);
Set<CtMethod<?>> listMethods = cclass.getMethods();
assertEquals(0, cclass.getMethodsByName("apply").size());
assertEquals(4, listMethods.size());
}
Aggregations