use of spoon.test.template.testclasses.SubstituteArrayAccessTemplate in project spoon by INRIA.
the class TemplateArrayAccessTest method testArrayAccess.
@Test
public void testArrayAccess() throws Exception {
// contract: the template engine supports variable access, typed as Array substitution
Launcher spoon = new Launcher();
spoon.addTemplateResource(new FileSystemFile("./src/test/java/spoon/test/template/testclasses/SubstituteArrayAccessTemplate.java"));
spoon.buildModel();
Factory factory = spoon.getFactory();
CtClass<?> resultKlass = factory.Class().create("Result");
CtStatement result = new SubstituteArrayAccessTemplate(new String[] { "a", null, "b" }).apply(resultKlass);
assertEquals("new java.lang.String[]{ \"a\", null, \"b\" }.toString()", result.toString());
}
Aggregations