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

Reply via email to