wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Shepherdson <david.shepherd...@ontology-partners.com>
Subject Re: Wickettester and session?
Date Thu, 03 Jan 2008 17:09:17 GMT
On 21 Dec 2007, at 6.03 pm, Nino Saturnino Martinez Vazquez Wael wrote:

> There seems to be a problem with wicket tester and the session  
> created (I use my own custom session). I create the wicket tester  
> like this:

...

>       wicketTester = new WicketTester(ZeuzGroupApplication.class);

...

> The application works fine without testing. But I get a class cast  
> exception when testing, since the session arent my custom one,

We also have our own custom session class, and our version of  
newSession() looks practically identical to yours.

However, when we construct the WicketTester, we construct our  
application too, rather than passing in a class name -- something like:

     wicketTester = new WicketTester(new ZeuzGroupApplication());

...and we're not seeing any ClassCastExceptions -- the session being  
constructed is definitely our custom class.

 From the look of the JavaDoc/code for WIcketTester, the constructor  
that takes in a Class is expecting that to be the class of the  
application's home page, *not* the application itself; it constructs a  
WebApplication to wrap the home page in and uses that. Is it possible,  
therefore, that you're mistakenly calling the wrong constructor?

Alternatively, if ZeuzGroupApplication really is a page class (and not  
an application), I would say that your best bet would be to construct  
the WicketTester with an application instance, as in  my example  
above, and then use the tester's startPage(Class) method to test your  
page.

David Shepherdson

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Mime
View raw message