1 package org.apache.turbine.services.template; 2 3 18 19 import junit.framework.Test; 20 import junit.framework.TestSuite; 21 22 import org.apache.turbine.services.TurbineServices; 23 import org.apache.turbine.test.BaseTurbineTest; 24 25 31 public class DefaultsTest 32 extends BaseTurbineTest 33 { 34 private TemplateService ts = null; 35 36 public DefaultsTest(String name) 37 throws Exception 38 { 39 super(name, "/conf/test/TemplateService.properties"); 40 41 ts = (TemplateService) TurbineServices.getInstance().getService(TemplateService.SERVICE_NAME); 42 } 43 44 public static Test suite() 45 { 46 return new TestSuite(DefaultsTest.class); 47 } 48 49 public void testDefaults() 50 { 51 assertEquals("isCaching failed!", ts.isCaching(), false); 53 54 assertEquals("Default Extension failed", ts.getDefaultExtension(), ""); 56 assertEquals("Default Template failed", ts.getDefaultTemplate(), TemplateService.DEFAULT_TEMPLATE_VALUE); 57 } 58 59 public void testTemplateDefaults() 60 { 61 assertEquals("Default Page failed", TemplateService.DEFAULT_TEMPLATE_VALUE, ts.getDefaultPage()); 63 assertEquals("Default Screen failed", TemplateService.DEFAULT_TEMPLATE_VALUE, ts.getDefaultScreen()); 64 assertEquals("Default Layout failed", TemplateService.DEFAULT_TEMPLATE_VALUE, ts.getDefaultLayout()); 65 assertEquals("Default Navigation failed", TemplateService.DEFAULT_TEMPLATE_VALUE, ts.getDefaultNavigation()); 66 assertEquals("Default LayoutTemplate failed", TemplateService.DEFAULT_TEMPLATE_VALUE, ts.getDefaultLayoutTemplate()); 67 } 68 69 public void testVelocityDefaults() 70 { 71 assertEquals("Default Page failed", "VelocityPage", ts.getDefaultPageName("foo.vm")); 73 assertEquals("Default Screen failed", "VelocityScreen", ts.getDefaultScreenName("foo.vm")); 74 assertEquals("Default Layout failed", "VelocityOnlyLayout", ts.getDefaultLayoutName("foo.vm")); 75 assertEquals("Default Navigation failed", "VelocityNavigation", ts.getDefaultNavigationName("foo.vm")); 76 assertEquals("Default LayoutTemplate failed", "Default.vm", ts.getDefaultLayoutTemplateName("foo.vm")); 77 } 78 } 79 80 | Popular Tags |