1 package org.apache.turbine.modules.screens; 2 3 18 19 import junit.framework.Test; 20 import junit.framework.TestSuite; 21 22 import org.apache.cactus.ServletTestCase; 23 import org.apache.turbine.Turbine; 24 import org.apache.turbine.modules.ScreenLoader; 25 import org.apache.turbine.services.TurbineServices; 26 import org.apache.turbine.services.rundata.RunDataService; 27 import org.apache.turbine.util.RunData; 28 29 35 public class ErrorTest extends ServletTestCase 36 { 37 private RunData data = null; 38 private org.apache.turbine.modules.screens.Error errorScreen = null; 39 private Turbine turbine = null; 40 41 46 public ErrorTest(String name) 47 { 48 super(name); 49 } 50 51 56 public static void main(String args[]) 57 { 58 junit.awtui.TestRunner.main(new String [] { ErrorTest.class.getName()}); 59 } 60 61 67 public static Test suite() 68 { 69 return new TestSuite(ErrorTest.class); 71 } 72 73 protected void setUp() throws Exception 74 { 75 super.setUp(); 76 77 } 78 79 82 protected void tearDown() throws Exception 83 { 84 turbine.destroy(); 85 super.tearDown(); 86 } 87 88 93 public void testDobuild() throws Exception 94 { 95 96 config.setInitParameter( 97 "properties", 98 "/WEB-INF/conf/TurbineCacheTest.properties"); 99 turbine = new Turbine(); 100 turbine.init(config); 101 102 data = ((RunDataService) TurbineServices.getInstance().getService(RunDataService.SERVICE_NAME)).getRunData(request, response, config); 103 104 errorScreen = 105 (org.apache.turbine.modules.screens.Error) ScreenLoader 106 .getInstance() 107 .getInstance("Error"); 108 data.getParameters ().setString ( "param", "param1Value" ); 109 errorScreen.doBuild(data); 110 111 assertTrue("Make sure we have our error parameter.",data.getPage().toString().indexOf("param1Value")>-1); 112 113 } 114 115 } 116 | Popular Tags |