I'm using Wicket 1.2.6 and I'm not able to create a custom web session.  The
code looks like: 
@Before
        public void setUp() {
                tester = new WicketTester();

                tester.setSessionFactory(new ISessionFactory() {

                        @Override
                        public Session newSession() {
                                return new 
AuthenticatedApplicationWebSession(..);
                        }
                });
..
}

However my newSession() method is never invoked because a new session is
created in the WicketTester  default constructor. I think that this is a
known issue that you can get around by extending the WicketTester class and
overriding the getSessionFactory() method. However my question concerns the
case when your custom websession has a constructor parameter that is not a
subclass of WebApplication. For example in this case I have a custom session
called AuthenticatedApplicationWebSession whose constructor looks like: 

public AuthenticatedApplicationWebSession(final AuthenticatedWebApplication
application) {
                super(application);
  ..
}

How do you create a mock session for this websession? WicketTester creates a
new instance of MockWebApplication which extends WebApplication and not my
custom AuthenticatedWebApplication. This becomes troublesome because the
constructor of my custom session takes a subclass of
AuthenticatedWebApplication and not a subclass of WebApplication. How should
I go about to test this?

Thanks
Johan
-- 
View this message in context: 
http://www.nabble.com/Setting-custom-session-in-a-wicket-unit-test-that-doesn%27t-take-an-Application-as-parameter.-tf4035596.html#a11464623
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