pokkie wrote:
>
> I am trying to write a test case for my listView that contains some links.
> When the user clicks on
> a link, a certain action should be performed, and it is for this action
> that I wish to write a test case for.
>
> I can get a handle on the ListView by using the
> wicketTester.getLastRenderedPage().get("pathToListView");,
> but the problem then is that the listView isn't populated. I thought about
> extracting the above method call,
> into a variable, so that the listView is returned, i.e.
>
> ----
> MyListView listView =
> (MyListView)wicketTester.getLastRenderedPage().get("pathToListView");
>
> // Populate the listView with a model object so that it will populate the
> ListView
> listView.setModelObject(new ModelObject());
>
> // Create a new ListItem so that the listView can be populated
> ListItem listItem = new ListItem(0, listView.getModel());
>
> // Populate the listView with the listItem
> listView.populateItem(listItem);
>
> // Execute ajax event
> wicketTester.executeAjaxEvent("pathToLinkOnListView","onclick");
> ----
>
> Would be greatful if somebody could advise me on how to proceed.
>
> Thanks,
>
> -- pokkie
>
>
>
>
>
>
>
Please use: ListItem listItem = (ListItem) listView.get(0); to get the
ListItem, then you can go ahead.
--
View this message in context:
http://www.nabble.com/Unit-testing-ListView-tp12631265p21157383.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]