@Martin, @Sven, I think it is a consequence of
https://fisheye6.atlassian.com/changelog/wicket-git?cs=ac3dddd842e365c724a996c863a1c40d09f71c49 because on https://github.com/apache/wicket/blob/wicket-7.x/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java#L725 lastRequest is set to request. So, getRedirectLocation will return null. Maybe add on condition on the finally that is only called if getRedirectLocation == null? On Wed, Mar 16, 2016 at 8:40 AM, Ernesto Reinaldo Barreiro < [email protected]> wrote: > Thanks! > > On Wed, Mar 16, 2016 at 8:31 AM, Martin Grigorov <[email protected]> > wrote: > >> Hi Ernesto, >> >> >> On Wed, Mar 16, 2016 at 7:36 AM, Ernesto Reinaldo Barreiro < >> [email protected]> wrote: >> >> > Hi, >> > >> > We have a simple test like.... >> > >> > ================================== >> > >> > WicketTester tester = tester(); >> > tester.startPage(AgencyInquiryPage.class); >> > >> > FormTester formTester = tester.newFormTester("form"); >> > formTester.setValue("businessDetails:firstName:field", "John"); >> > formTester.setValue("businessDetails:lastName:field", "Smith"); >> > formTester.setValue("businessDetails:companyName:field", "Comp"); >> > formTester.setValue("businessDetails:streetAndNumber:field", "str. 13"); >> > formTester.setValue("businessDetails:zipcode:field", "66666"); >> > formTester.setValue("businessDetails:city:field", "Munich"); >> > formTester.select("businessDetails:country:select", 0); >> > formTester.setValue("phoneNumber:field", "666333"); >> > formTester.setValue("email:field", "[email protected]"); >> > formTester.submit("submit"); >> > >> > String actualRedirectUrl = >> tester.getLastResponse().getRedirectLocation(); >> > Assert.assertTrue(actualRedirectUrl.endsWith("expected/url")); >> > >> > ================================== >> > >> > and inside on submit we throw a >> > >> > ================================ >> > >> > public class RedirectToAbsoluteUrlException extends >> RedirectToUrlException >> > { >> > >> > private static final long serialVersionUID = 1L; >> > >> > public RedirectToAbsoluteUrlException(String redirectUrl) { >> > this(redirectUrl, HttpServletResponse.SC_MOVED_TEMPORARILY); >> > } >> > >> > public RedirectToAbsoluteUrlException(String redirectUrl, int >> > statusCode) { >> > super(UrlUtils.toAbsoluteUrl(redirectUrl), statusCode); >> > } >> > } >> > >> > ================================ >> > >> > Test was passing on 6.22.0 but fails on 7.2.0 because actualRedirectUrl >> is >> > NULL. Looking at the migration guide I see. >> > >> > >> > >> https://cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+7.0#MigrationtoWicket7.0-(Base)WicketTestercanbereusedafterthrownexception >> > >> > Before I dive into the code... >> > >> > Questions: >> > >> > 1- Is this a known issue? >> > >> >> No. >> >> >> > 2- Are we doing something wrong? >> > >> >> Please create a quickstart if you don't find the solution yourself. >> >> >> > >> > -- >> > Regards - Ernesto Reinaldo Barreiro >> > >> > > > > -- > Regards - Ernesto Reinaldo Barreiro > -- Regards - Ernesto Reinaldo Barreiro
