Wicket
  1. Wicket
  2. WICKET-3977

Calling FormTester.select for DropDownChoice invokes onSelectionChanged with null argument

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5-RC5.1
    • Fix Version/s: 1.5.1
    • Component/s: wicket
    • Labels:
      None
    • Environment:
      Linux Ubuntu 11.04, Java 1.6.0_26

      Description

      I have a DropDownChoice which has a wantOnSelectionChangedNotifications that returns true, so that the onSelectionChanged is called when the selection changes.

      In a unit test a selection is made for the dropdown using: formTester.select("dropDown", 0);

      The FormTester sets the selected value for the dropdown as a post parameter in the current request and the calls BaseWicketTester#executeListener to process the request for the onSelectionChanged event.

      In BaseWicketTester#executeListener however the the request post parameters previously set are ignored, by creating a new empty request:
      MockHttpServletRequest request = new MockHttpServletRequest(application, httpSession, servletContext);

      I guess either the current request should be used instead of new-ing one or the post parameters should be copied from the current request instance.

      1. wicket3977.zip
        2 kB
        Marcel Cullens

        Activity

        Hide
        Martin Grigorov added a comment -

        Can you help us a bit by preparing a quickstart with the failure? Thanks !

        Show
        Martin Grigorov added a comment - Can you help us a bit by preparing a quickstart with the failure? Thanks !
        Hide
        Marcel Cullens added a comment - - edited

        I've added the sources for a page and unit test that reproduce the issue.

        Also I've found a workaround (see unit test), but it's not very elegant.

        Show
        Marcel Cullens added a comment - - edited I've added the sources for a page and unit test that reproduce the issue. Also I've found a workaround (see unit test), but it's not very elegant.
        Hide
        Mathijs de Groot added a comment -

        I'm struggling with the same issue.
        I think every developer that uses Forms with Dropdowns (and writes good Unit tests) will face this issue.
        @Marcel: Thanks for the (not very elegant) workaround. Hope this issue will be fixed soon.

        Show
        Mathijs de Groot added a comment - I'm struggling with the same issue. I think every developer that uses Forms with Dropdowns (and writes good Unit tests) will face this issue. @Marcel: Thanks for the (not very elegant) workaround. Hope this issue will be fixed soon.

          People

          • Assignee:
            Igor Vaynberg
            Reporter:
            Marcel Cullens
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development