You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Peter Gardfjell <pe...@gmail.com> on 2008/12/02 08:29:15 UTC

Re: How to add cookies to WicketTester?

Thanks Vit,

your approach seems to be working. That is, use something like

		Cookie cookie = new Cookie("name", "value");		
		WicketTester wicketTester = new WicketTester(new MyApplication());
		wicketTester.getServletRequest().addCookie(cookie);
		wicketTester.startPage(new MyPage());		
		wicketTester.assertRenderedPage(MyPage.class);

regards, Peter


Vit Rozkovec wrote:
> 
> 
> Hallo,
> I think it should work with one of those methods:
> 
> public final Page startPage(final ITestPageSource testPageSource)
> public final Page startPage(final Page page)
> instead of wicketTester.startPage(FooPage.class);
> 
> and also you should use wicket tester's request for adding cookies:
> wicketTester.getServletRequest()
> 
> have not tried it though.
> 
> Vitek
> 
> 
> Peter Gardfjell wrote:
>> Hi all,
>>
>> does anyone know of some easy way of adding cookies to WicketTester prior
>> to
>> having it visit page?
>>
>> That is something along the line of
>>
>> 		WicketTester wicketTester = new WicketTester(new MyApplication());
>> 		Cookie cookie = new Cookie("name", "value");
>>                 /*
>>                     ... insert code for adding cookie to request here ...
>>                 */
>> 		wicketTester.startPage(FooPage.class);
>> 		wicketTester.assertRenderedPage(FooPage.class);
>>
>> regards, Peter
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-add-cookies-to-WicketTester--tp20733095p20787361.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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