You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Eric Weise <er...@roundpeg.com> on 2009/05/29 20:20:45 UTC

Mocking out component.setResponsePage

Hi,

Does anyone know a way to mock out calls to component.setResponsePage  
when unit testing?  This method causes me to not only mock out  
dependencies in the page I'm testing, but in the response page as  
well, which is a pain.  I thought that maybe I could extend  
RequestCycle and override the setResponsePage methods but I don't see  
how to make wicket use my extended request cycle.  Can this be done or  
is there another way?

much thanks
Eric

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


Re: Mocking out component.setResponsePage

Posted by Eric Weise <er...@roundpeg.com>.
Awesome.  I think that's exactly what I need.  Thanks Clint.

-Eric

On May 29, 2009, at 12:24 PM, Clint Popetz wrote:

> You can construct a WicketTester with an application subclass...it  
> just
> creates a default one for you internally if you don't:
>
> WicketTester yourTester = new WicketTester(new
> WicketTester.DummyWebApplication() {
>        public RequestCycle newRequestCycle(final Request request,  
> final
> Response response) {
>    //...
>    }
> });
>
>
>
> -Clint
>
> On Fri, May 29, 2009 at 2:02 PM, Eric Weise <er...@roundpeg.com> wrote:
>
>> Hi Clint,
>>
>> One thing though is my unit test is not invoking the seam framework  
>> and it
>> looks like that class extends the SeamWebApplication.  My unit test  
>> just
>> uses WicketTester and has a routine to inject mock objects on any @In
>> annotation fields in the component hierarchy.        Is there a  
>> similar
>> application I can override somewhere in the wickettester?
>>
>> thanks
>> Eric
>>
>>
>> On May 29, 2009, at 11:43 AM, Clint Popetz wrote:
>>
>> Hi Eric :)
>>>
>>> Override WicketApplication.newRequestCycle()
>>>
>>> -Clint
>>>
>>> On Fri, May 29, 2009 at 1:20 PM, Eric Weise <er...@roundpeg.com>  
>>> wrote:
>>>
>>> Hi,
>>>>
>>>> Does anyone know a way to mock out calls to  
>>>> component.setResponsePage
>>>> when
>>>> unit testing?  This method causes me to not only mock out  
>>>> dependencies in
>>>> the page I'm testing, but in the response page as well, which is  
>>>> a pain.
>>>> I
>>>> thought that maybe I could extend RequestCycle and override the
>>>> setResponsePage methods but I don't see how to make wicket use my
>>>> extended
>>>> request cycle.  Can this be done or is there another way?
>>>>
>>>> much thanks
>>>> Eric
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>> --
>>> Clint Popetz
>>> http://42lines.net
>>> Scalable Web Application Development
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> -- 
> Clint Popetz
> http://42lines.net
> Scalable Web Application Development


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


Re: Mocking out component.setResponsePage

Posted by Clint Popetz <cl...@42lines.net>.
You can construct a WicketTester with an application subclass...it just
creates a default one for you internally if you don't:

WicketTester yourTester = new WicketTester(new
WicketTester.DummyWebApplication() {
        public RequestCycle newRequestCycle(final Request request, final
Response response) {
    //...
    }
});



-Clint

On Fri, May 29, 2009 at 2:02 PM, Eric Weise <er...@roundpeg.com> wrote:

> Hi Clint,
>
> One thing though is my unit test is not invoking the seam framework and it
> looks like that class extends the SeamWebApplication.  My unit test just
> uses WicketTester and has a routine to inject mock objects on any @In
> annotation fields in the component hierarchy.        Is there a similar
> application I can override somewhere in the wickettester?
>
> thanks
> Eric
>
>
> On May 29, 2009, at 11:43 AM, Clint Popetz wrote:
>
>  Hi Eric :)
>>
>> Override WicketApplication.newRequestCycle()
>>
>> -Clint
>>
>> On Fri, May 29, 2009 at 1:20 PM, Eric Weise <er...@roundpeg.com> wrote:
>>
>>  Hi,
>>>
>>> Does anyone know a way to mock out calls to component.setResponsePage
>>> when
>>> unit testing?  This method causes me to not only mock out dependencies in
>>> the page I'm testing, but in the response page as well, which is a pain.
>>>  I
>>> thought that maybe I could extend RequestCycle and override the
>>> setResponsePage methods but I don't see how to make wicket use my
>>> extended
>>> request cycle.  Can this be done or is there another way?
>>>
>>> much thanks
>>> Eric
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>> --
>> Clint Popetz
>> http://42lines.net
>> Scalable Web Application Development
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Clint Popetz
http://42lines.net
Scalable Web Application Development

Re: Mocking out component.setResponsePage

Posted by Eric Weise <er...@roundpeg.com>.
Hi Clint,

One thing though is my unit test is not invoking the seam framework  
and it looks like that class extends the SeamWebApplication.  My unit  
test just uses WicketTester and has a routine to inject mock objects  
on any @In annotation fields in the component hierarchy.  	Is there a  
similar application I can override somewhere in the wickettester?

thanks
Eric

On May 29, 2009, at 11:43 AM, Clint Popetz wrote:

> Hi Eric :)
>
> Override WicketApplication.newRequestCycle()
>
> -Clint
>
> On Fri, May 29, 2009 at 1:20 PM, Eric Weise <er...@roundpeg.com> wrote:
>
>> Hi,
>>
>> Does anyone know a way to mock out calls to  
>> component.setResponsePage when
>> unit testing?  This method causes me to not only mock out  
>> dependencies in
>> the page I'm testing, but in the response page as well, which is a  
>> pain.  I
>> thought that maybe I could extend RequestCycle and override the
>> setResponsePage methods but I don't see how to make wicket use my  
>> extended
>> request cycle.  Can this be done or is there another way?
>>
>> much thanks
>> Eric
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> -- 
> Clint Popetz
> http://42lines.net
> Scalable Web Application Development


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


Re: Mocking out component.setResponsePage

Posted by Clint Popetz <cl...@42lines.net>.
Hi Eric :)

Override WicketApplication.newRequestCycle()

-Clint

On Fri, May 29, 2009 at 1:20 PM, Eric Weise <er...@roundpeg.com> wrote:

> Hi,
>
> Does anyone know a way to mock out calls to component.setResponsePage when
> unit testing?  This method causes me to not only mock out dependencies in
> the page I'm testing, but in the response page as well, which is a pain.  I
> thought that maybe I could extend RequestCycle and override the
> setResponsePage methods but I don't see how to make wicket use my extended
> request cycle.  Can this be done or is there another way?
>
> much thanks
> Eric
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Clint Popetz
http://42lines.net
Scalable Web Application Development