TemplateController { public StringBuilder includeArgs(String templateName, ASTNode node, List<Object> templateArguments) { StringBuilder ret = new StringBuilder(); List<HookPoint> templateForwardings = config.getGlex().getTemplateForwardings(templateName, node); for (HookPoint tn : templateForwardings) { ret.append(tn.processValue(this, node, templateArguments)); } return ret; } TemplateController(GeneratorSetup setup, String templatename); GeneratorSetup getGeneratorSetup(); String getTemplatename(); StringBuilder include(List<String> templatenames, List<ASTNode> astlist); void signature(List<String> parameterNames); void signature(String... parameterName); StringBuilder include(String templateName); StringBuilder include(List<String> templateNames); StringBuilder include(List<String> templateNames, ASTNode ast); StringBuilder include(String templateName, List<ASTNode> astlist); StringBuilder include(String templateName, ASTNode ast); StringBuilder includeArgs(String templateName, ASTNode node, List<Object> templateArguments); StringBuilder includeArgs(String templateName, List<Object> templateArguments); StringBuilder includeArgs(String templateName, String... templateArgument); void include(Object empty1, Object empty2); void write(String templateName, String qualifiedFileName, ASTNode ast); void write(String templateName, String qualifiedFileName, String fileExtension, ASTNode ast); void write(final String templateName, final Path filePath, final ASTNode ast); void writeArgs(final String templateName, final String qualifiedFileName,
                        final String fileExtension, final ASTNode ast, final List<Object> templateArguments); void writeArgs(final String templateName, final Path filePath, final ASTNode ast,
                        final List<Object> templateArguments); Object instantiate(String className); boolean existsHandwrittenFile(String filename); boolean existsHandwrittenClass(String qualifiedName,
      String extension); boolean existsHandwrittenClass(String qualifiedName); Object instantiate(String className, List<Object> params); void trace(String msg, String logName); void debug(String msg, String logName); void info(String msg, String logName); void warn(String msg); void error(String msg); static final String AST; static final String TC; static final String GLEX; }
@Test public void testDefaultMethods() { GlobalExtensionManagement glex = new GlobalExtensionManagement(); fileHandler = new FileReaderWriterMock(); GeneratorSetup config = new GeneratorSetup(); config.setGlex(glex); config.setFileHandler(fileHandler); config.setOutputDirectory(TARGET_DIR); config.setTracing(false); TemplateController tc = new TemplateControllerMock(config, ""); DefaultImpl def = new DefaultImpl(); StringBuilder result = tc .includeArgs(TEMPLATE_PACKAGE + "DefaultMethodCall", Lists.newArrayList(def)); assertNotNull(result); assertEquals("A", result.toString().trim()); FileReaderWriter.init(); }