Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-1434

WicketTester.startPage(Class) does not trigger WebRequestCycle.onBeginRequest

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.3.2
    • 1.3.3
    • wicket
    • None

    Description

      While using WicketTester to test my WebApplication that is using a custom WebRequestCycle and WebRequestCycleProcessor I noticed that WicketTester does not follow the same RequestCycle as it would do when running in a real live environment resulting in MyWebRequestCycle.onBeginRequest not being called.

      Using startPage(Page) will call MyWebRequestCycle.onBeginRequest but then the IRequestTarget that is resolved from the Request indicates the Request comes from the DummyHomePage.testPage link.

      Can startPage be implemented that it really resembles the real live environment? After some research and testing I came up with this implementation, maybe it can be used:

      public Page startPage(Class pageClass) {
      WebRequestCycle requestCycle = super.setupRequestAndResponse();
      requestCycle.getRequest().getRequestParameters().setBookmarkablePageClass(pageClass.getName());
      super.processRequestCycle(requestCycle);
      return super.getLastRenderedPage();
      }

      Attachments

        Issue Links

          Activity

            People

              ivaynberg Igor Vaynberg
              lvonk Lars Vonk
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: