You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by l yeung <le...@gmail.com> on 2010/04/04 06:49:08 UTC
Best way to test clickLink on a bookmarkable page link in ListView
Hi,
What would be the best way to test clickLink on a bookmarkabel page link
added into ListView? How should I construct URL for assertPageLink,
clickLink and assertLabel methods?
Test code:
tester.assertComponent("userLinks", ListView.class);
tester.assertListView("userLinks", new
ArrayList<User>(userService.findAllSurveys()));
// tester.assertPageLink(???, UserMainPage.class);
// tester.clickLink(???)
// tester.assertLabel(???, "name1");
Page source:
Collection<User> users = userService.findAllUsers();
ListView<User> listView = new ListView<User>("userLinks", new
ArrayList<User>(users)) {
@Override
protected void populateItem(ListItem<User> listItem) {
User user = listItem.getModelObject();
String username = user.getUserName();
String name = user.getName();
PageParameters pageParameters = new PageParameters();
pageParameters.add(UserMainPage.USER_ID_PARAMETER_NAME,
username);
listItem.add(new BookmarkablePageLink<UserMainPage>("link",
UserMainPage.class, pageParameters).add(
new Label("nameLabel", name)));
}
};
Thanks in advance.
Cheers