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

WicketTester (Spring + hibernate) / BaseWicketTest.lastRenderedPage is empty

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Cannot Reproduce
    • None
    • None
    • wicket
    • Linux / Java 7 using wicket-sping and hibernate

    Description

      I have a sample application here: https://github.com/bartgeluykens/Whiskey

      Tests fails because BaseWicketTest.lastRenderedPage is empty.

      The reason is that in the RenderPageRequestHandler we execute the following statement Application.get().getPageRendererProvider().get(this) which depends on an other BaseWicketTest instance than the current one. Afterwards the lastRenderedPage gets filled on the wrong class instance.

      I temporary solved it by adding the following statements in the processRequest procedure underneath the if "if (!requestCycle.processRequestAndDetach())" block:

      if (Application.get().getPageRendererProvider() instanceof LastPageRecordingPageRendererProvider)

      { LastPageRecordingPageRendererProvider lastPageRecordingPageRendererProvider = (LastPageRecordingPageRendererProvider) Application.get().getPageRendererProvider(); lastRenderedPage = lastPageRecordingPageRendererProvider.getLastPage(); }

      Probably the best solution is to make the lastRenderedPage variable static, but I did not test this.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bart.geluykens Bart Geluykens
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified