/** Verify that the redirect method actually redirects to a new page as we expect. */
  @Test
  public void testRedirect() {
    final ParameterSpec spec = new ParameterSpec<TestBean>(TestPage.class);

    // Force the redirect during wicket's normal request processing.
    // For example, when a link is clicked.
    WicketTestUtils.startComponentWithXHtml(
        this.tester,
        new Link("link") {
          public void onClick() {
            spec.redirect(Model.of(new TestBean()));
          }
        },
        "<a wicket:id=\"link\">link</a>");

    // Click the link that we just rendered
    this.tester.clickLink("link");

    // The redirect should have forced wicket to render TestPage
    this.tester.assertRenderedPage(TestPage.class);
  }
 private LogoutLink render() throws Exception {
   LogoutLink link = new LogoutLink("link");
   WicketTestUtils.startComponentWithHtml(this.tester, link, "<a wicket:id='link'>Log out</a>");
   WicketTestUtils.assertValidMarkup(this.tester);
   return link;
 }