You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Andrea Del Bene (JIRA)" <ji...@apache.org> on 2012/06/20 10:35:42 UTC

[jira] [Comment Edited] (WICKET-4610) WicketTester.assertRedirectUrl always fails because it always thinks the redirect was null

    [ https://issues.apache.org/jira/browse/WICKET-4610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13397358#comment-13397358 ] 

Andrea Del Bene edited comment on WICKET-4610 at 6/20/12 8:35 AM:
------------------------------------------------------------------

Regarding to the second issue related to response status, I've modified method sendRedirect of class MockHttpServletResponse in order to change its status to 302 when it is invoked. I've updated the patch file.
                
      was (Author: bitstorm):
    Regarding the second issue related to response status, I've modified method sendRedirect of class MockHttpServletResponse in order to change its status to 302 when it is invoked. I've updated the patch file.
                  
> WicketTester.assertRedirectUrl always fails because it always thinks the redirect was null
> ------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4610
>                 URL: https://issues.apache.org/jira/browse/WICKET-4610
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.7
>            Reporter: Trejkaz
>         Attachments: WICKET-4610.diff
>
>
> I have a page which always redirects.
> When I write a test for this page, tester.assertRedirectUrl(...) always fails with the assertion failure showing that the redirect URL was null.
> The page does redirect when running the application for real and I have stepped through in the debugger when running the test and it goes all the way to the HttpServletResponse.sendRedirect call.
> However, in the same debugging session, tester.getLastResponse().getRedirectLocation() == null
> Cut-down example follows.
> public class AlwaysRedirectPage extends WebPage
> {
>     public AlwaysRedirectPage()
>     {
>         // redirects to another web server on the same computer
>         throw new RedirectToUrlException("http://localhost:4333/");
>     }
> }
> public class TestAlwaysRedirectPage
> {
>     @Test
>     public void test()
>     {
>         WicketTester tester = new WicketTester();
>         tester.startPage(AlwaysRedirectPage.class);
>         tester.assertRedirectUrl("http://localhost:4333/");
>     }
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira