If you have Turbine started you may be able to create a RunData via the RunDataService singleton. You may have to mock the http response and request though. I'm not so sure how that would work. Is there a way you can unit test your code without requiring TemplateLink and a fully populated RunData? It looks from your test class name that you are testing a tool which extends TemplateLink. Turbine sometimes doesn't make it real easy to unit test, ala the feeling you need to mock objects.
Another option for testing of this type may be Apache/Cactus ( jakarta.apache.org/cactus ). This will startup Turbine in the servlet container, allow you to create a real RunData from a request/response and still unit test. ================================================================= Jeffrey D. Brekke Quad/Graphics [EMAIL PROTECTED] http://www.qg.com > -----Original Message----- > From: Chris K Chew [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, September 24, 2002 5:22 PM > To: [EMAIL PROTECTED] > Subject: Set up RunData in Junit Tests? > > > Hello. > > Does anybody have any suggestions for getting a RunData > object sufficient > for the TemplateLink object in a Junit test? I am using the second > (AllTests) method described in the App Testing section of the > TDK site. > > I have tried: > > RunData data = new DefaultTurbineRunData(); > > and > > MockControl rdCtl = EasyMock.controlFor(RunData.class); > RunData data = (RunData)rdCtl.getMock(); > > But both give me a NullPointerException: > > java.lang.NullPointerException > at org.apache.turbine.util.DynamicURI.init(DynamicURI.java:634) > at org.apache.turbine.util.DynamicURI.init(DynamicURI.java:341) > at org.apache.turbine.util.DynamicURI.init(DynamicURI.java:328) > at org.apache.turbine.util.DynamicURI.<init>(DynamicURI.java:155) > at > org.apache.turbine.util.template.TemplateLink.<init>(TemplateL > ink.java:106) > at > com.fitmyschedule.tests.FmsLinkToolTest.testLinkNewUser(Unknow > n Source) > at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22) > at junit.extensions.TestSetup$1.protect(TestSetup.java:19) > at junit.extensions.TestSetup.run(TestSetup.java:23) > > Line 634 of DynamicURI calls getServerScheme() on ServerData, so I am > guessing that > ServerData isn't correctly populated (i.e. null). > > Thanks in advance, > > Chris > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
