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

Reply via email to