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

WicketTester recreates session after setting attributes on it

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4-M1
    • 1.5-M3
    • wicket
    • None

    Description

      The following test for internationalization doesn't work, as rendering the page will create a new session.

      WicketTester tester = new WicketTester();
      tester.getWicketSession().setLocale(Locale.FRENCH);
      tester.startPage(HelloWorld.class);
      tester.assertLabel("message", "Bonjour tout le monde!");

      But setting up the response and request first works around recreating the session

      WicketTester tester = new WicketTester();
      tester.setupRequestAndResponse();
      tester.getWicketSession().setLocale(Locale.FRENCH);
      tester.startPage(HelloWorld.class);
      tester.assertLabel("message", "Bonjour tout le monde!");

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            dashorst Martijn Dashorst
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: