Hi Igor, Thanks for your reply. Here is the thing: (using wicket 1.2.5)
I could not find the constructor that takes the "Application" object. So I tried the following. tester = new WicketTester(); tester.set(new xyzApplication()); But this gives me the following stack trace. wicket.WicketRuntimeException: Use Application.init() method for configuring your application object at wicket.Application.getSettings(Application.java:606) at wicket.Application.getDebugSettings(Application.java:449) at wicket.protocol.http.HttpSessionStore.setAttribute(HttpSessionStore.java:51) at wicket.protocol.http.AbstractHttpSessionStore.bind(AbstractHttpSessionStore.java:165) at wicket.protocol.http.MockWebApplication.setupRequestAndResponse(MockWebApplication.java:411) at wicket.util.tester.WicketTester.startPage(WicketTester.java:282) at com.xxx.abc.wicket.pages.sections.TestDefaultHomePage.setUp(TestDefaultHomePage.java:23) at junit.framework.TestCase.runBare(TestCase.java:125) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Can you please suggest. Also is there any place where i could find some wicketTester samples. That would surely be helpfull to the community. I would like to thank you for an amazing framework "WICKET" :) Thanks & Regards, Ravi Gidwani. igor.vaynberg wrote: > > myapplication app=nnew myapplication(); > wickettester tester=new wicketteseter(app); > > -igor > > > On 4/26/07, Akshat <[EMAIL PROTECTED]> wrote: >> >> >> package com.xyz.xyzcom.wicket.pages.sections; >> >> import com.xyz.xyzcom.wicket.pages.DefaultxyzPage; >> >> public class DefaultHomePage extends DefaultxyzPage { >> >> >> public static final String HOME = "home"; >> >> public String getSection() { >> return HOME; >> } >> >> public String getTitle() { >> return "xyz Home"; >> } >> >> } >> >> On testing the above code the test case gives following error: -- The >> stack >> trcae of the test code is given below >> >> package com.xyz.xyzcom.wicket.pages.sections; >> import junit.framework.TestCase; >> import wicket.util.tester.WicketTester; >> import com.xyz.xyzcom.wicket.xyzApplication; >> import com.xyz.xyzcom.wicket.pages.Home; >> >> public class TestDefaultHomePage extends TestCase{ >> private WicketTester tester; >> public TestDefaultHomePage(){ >> super ("Test DefaultHomePage class"); >> } >> protected void setUp() >> { >> tester = new WicketTester(); >> >> } >> >> public void testGetTitle(){ >> >> tester.startPage(DefaultHomePage.class); >> tester.assertRenderedPage(DefaultHomePage.class); >> >> java.lang.ClassCastException: wicket.util.tester.WicketTester >> at com.xyz.xyzcom.wicket.xyzApplication.get(xyzApplication.java >> :68) >> at >> com.xyz.xyzcom.wicket.pages.sections.TestDefaultHomePage.setUp( >> TestDefaultHomePage.java:21) >> at junit.framework.TestCase.runBare(TestCase.java:125) >> at junit.framework.TestResult$1.protect(TestResult.java:106) >> at junit.framework.TestResult.runProtected(TestResult.java:124) >> at junit.framework.TestResult.run(TestResult.java:109) >> at junit.framework.TestCase.run(TestCase.java:118) >> at junit.framework.TestSuite.runTest(TestSuite.java:208) >> at junit.framework.TestSuite.run(TestSuite.java:203) >> at >> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run( >> JUnit3TestReference.java:128) >> at >> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java >> :38) >> at >> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests( >> RemoteTestRunner.java:460) >> at >> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests( >> RemoteTestRunner.java:673) >> at >> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run( >> RemoteTestRunner.java:386) >> at >> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( >> RemoteTestRunner.java:196) >> >> The above test case needs the Wicket Tester object but client specific >> code >> had typecast the WicketTester object to its owned class object. The >> snippet >> of that code is given below:- >> >> public class xyzApplication extends AuthenticatedWebApplication >> implements >> ApplicationContextAware { >> >> public static xyzApplication get() { >> return (xyzApplication) Application.get(); >> } >> >> Query is : Is there any way by which I can force the Wicket Tester object >> to >> get typecast in client specific class object. Do i need to make any >> configuration changes ..... >> -- >> View this message in context: >> http://www.nabble.com/How-to-force-WicketTester-object-to-type-cast-in-other-Application-object-tf3650578.html#a10197182 >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by DB2 Express >> Download DB2 Express C - the FREE version of DB2 express and take >> control of your XML. No limits. Just data. Click to get it now. >> http://sourceforge.net/powerbar/db2/ >> _______________________________________________ >> Wicket-user mailing list >> Wicket-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wicket-user >> > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > -- View this message in context: http://www.nabble.com/How-to-force-WicketTester-object-to-type-cast-in-other-Application-object-tf3650578.html#a10213421 Sent from the Wicket - User mailing list archive at Nabble.com. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user