[
https://issues.apache.org/jira/browse/WICKET-4610?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Trejkaz updated WICKET-4610:
----------------------------
Description:
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/");
}
}
was:
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
> 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
>
> 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