Search in sources :

Example 1 with ObjectIsNotParamTemplate

use of spoon.test.template.testclasses.ObjectIsNotParamTemplate in project spoon by INRIA.

the class TemplateTest method testObjectIsNotParamTemplate.

@Test
public void testObjectIsNotParamTemplate() throws Exception {
    Launcher spoon = new Launcher();
    spoon.addTemplateResource(new FileSystemFile("./src/test/java/spoon/test/template/testclasses/ObjectIsNotParamTemplate.java"));
    spoon.buildModel();
    Factory factory = spoon.getFactory();
    // contract: String value is substituted in substring of literal, named element and reference
    final CtClass<?> result = (CtClass<?>) new ObjectIsNotParamTemplate().apply(factory.createClass());
    assertEquals(0, result.getMethodsByName("methXXXd").size());
    assertEquals(1, result.getMethodsByName("method").size());
}
Also used : CtClass(spoon.reflect.declaration.CtClass) ObjectIsNotParamTemplate(spoon.test.template.testclasses.ObjectIsNotParamTemplate) Launcher(spoon.Launcher) Factory(spoon.reflect.factory.Factory) FileSystemFile(spoon.support.compiler.FileSystemFile) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 Launcher (spoon.Launcher)1 CtClass (spoon.reflect.declaration.CtClass)1 Factory (spoon.reflect.factory.Factory)1 FileSystemFile (spoon.support.compiler.FileSystemFile)1 ObjectIsNotParamTemplate (spoon.test.template.testclasses.ObjectIsNotParamTemplate)1