You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by calle sollander <ca...@msn.com> on 2015/11/22 12:37:34 UTC

Testing for an IEvent

Hello!I have a question about how to test that an IEvent has been sent.
Say that I have a Panel with a AjaxLink on it and depending on something or other diffrentevents are sent when the user clicks the link.Is there a way to set up a unit test using the Wickettester that can detect which events are sent?
Regards Calle S 		 	   		  

Re: Testing for an IEvent

Posted by Sven Meier <sv...@meiers.net>.
Hi,

you can override BaseWicketTester#createPage(), returning your own page 
(might be a subclass of StartComponentInPage) which records all events 
handed to Component#onEvent().

Regards
Sven


On 22.11.2015 12:37, calle sollander wrote:
> Hello!I have a question about how to test that an IEvent has been sent.
> Say that I have a Panel with a AjaxLink on it and depending on something or other diffrentevents are sent when the user clicks the link.Is there a way to set up a unit test using the Wickettester that can detect which events are sent?
> Regards Calle S 		 	   		
>

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


Re: Testing for an IEvent

Posted by Marcel Barbosa Pinto <ma...@gmail.com>.
Hello,

Question for the experts:

I have a search page that has a POJO as a model. It uses this model to
filter a search through a form component.
Now I have another page (let's say quick search) that needs to send (post)
this POJO model to this search page, in order to do the search filtering.
As PageParameters can't(?) be used to send this "complex model", how the
search page can receive it from another page? May I have to use Events?

Thank you guys.

Re: Testing for an IEvent

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

There are several ways:

1) tester.startComponentInPage(new MyComponent(...) { @Override public void
onEvent(IEvent event) { track(event); } })
2) Same as above for Page
3) dependending on the IEventSink and Broadcast type you use you can track
the events also in YourApplication#onEvent(), YourSession#onEvent() and
YourRequestCycle#onEvent()
4) you can setup custom IFrameworkSettings and track the dispatched events

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Sun, Nov 22, 2015 at 12:37 PM, calle sollander <ca...@msn.com>
wrote:

> Hello!I have a question about how to test that an IEvent has been sent.
> Say that I have a Panel with a AjaxLink on it and depending on something
> or other diffrentevents are sent when the user clicks the link.Is there a
> way to set up a unit test using the Wickettester that can detect which
> events are sent?
> Regards Calle S