1 52 53 package freemarker.testcase; 54 55 import java.io.IOException ; 56 import java.io.StringWriter ; 57 import java.util.Locale ; 58 59 import freemarker.template.SimpleScalar; 60 import freemarker.template.Template; 61 import freemarker.template.TemplateException; 62 63 68 public class TestLocalization extends AbstractTestCase { 69 70 public TestLocalization(String aTestname) { 71 super( aTestname ); 72 } 73 74 77 public void setUp() { 78 setUpFiles( "test-local.html" ); 79 root.put("message", new SimpleScalar("Hello, world!")); 80 81 } 82 83 89 public void runTest() throws TemplateException, IOException { 90 Template template = config.getTemplate( "test-local.html", new Locale ("en", "AU")); 91 StringWriter sw = new StringWriter (); 92 template.process(root, sw); 93 showTestResults( referenceText, sw.toString() ); 94 } 95 96 98 public static void main( String [] argc ) throws Exception { 99 AbstractTestCase cTest = new TestLocalization( "test-local.html" ); 100 cTest.run(); 101 } 102 } | Popular Tags |