1 52 53 package freemarker.testcase; 54 55 import java.util.ArrayList ; 56 57 import freemarker.template.SimpleCollection; 58 import freemarker.template.TemplateMethodModel; 59 import freemarker.template.TemplateNodeModel; 60 import freemarker.template.TemplateSequenceModel; 61 62 66 public class TestTypeBuiltins extends AbstractTestCase { 67 68 69 public TestTypeBuiltins( String aTestname ) { 70 super( aTestname ); 71 } 72 73 76 public void setUp() { 77 setUpFiles( "test-typebuiltins.txt" ); 78 root.put("testmethod", new TestMethod()); 79 root.put("testnode", new TestNode()); 80 root.put("testcollection", new SimpleCollection(new ArrayList ())); 81 } 82 83 85 public static void main( String [] argc ) throws Exception { 86 AbstractTestCase cTest = new TestTypeBuiltins("test-typebuiltins.txt"); 87 88 cTest.run(); 89 } 90 } 91 92 class TestMethod implements TemplateMethodModel { 93 public Object exec(java.util.List arguments) { 94 return "x"; 95 } 96 } 97 98 class TestNode implements TemplateNodeModel { 99 100 public String getNodeName() { 101 return "name"; 102 } 103 104 public TemplateNodeModel getParentNode() { 105 return null; 106 } 107 108 public String getNodeType() { 109 return "element"; 110 } 111 112 public TemplateSequenceModel getChildNodes() { 113 return null; 114 } 115 116 public String getNodeNamespace() { 117 return null; 118 } 119 } 120 | Popular Tags |