1 52 53 package freemarker.testcase; 54 55 import freemarker.template.SimpleHash; 56 import freemarker.template.SimpleScalar; 57 58 64 public class TestFunction extends AbstractTestCase { 65 66 public TestFunction(String aTestname) { 67 super( aTestname ); 68 } 69 70 73 public void setUp() { 74 setUpFiles( "test-function.html" ); 75 76 root.put("message", new SimpleScalar("Hello, world!")); 77 78 SimpleHash urls = new SimpleHash(); 79 urls.put( "home", "/home.html" ); 80 urls.put( "about", "/about.html" ); 81 root.put( "urls", urls ); 82 83 SimpleHash images = new SimpleHash(); 84 images.put( "home", "/images/home.png" ); 85 images.put( "about", "/image/about-us.jpeg" ); 86 root.put( "images", images ); 87 88 SimpleHash prefs = new SimpleHash(); 89 prefs.put( "showImages", true ); 90 root.put( "preferences", prefs ); 91 } 92 93 95 public static void main( String [] argc ) throws Exception { 96 AbstractTestCase cTest = new TestFunction( "test-function.html" ); 97 cTest.run(); 98 } 99 } 100 | Popular Tags |