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

Dirk Forchel commented on WICKET-6910:
--------------------------------------

I'm not sure whether the test is correct or not but this test was inpired (or 
taken) from the Wicket core.

With tester.setExposeException(false) I expect, that the original exception 
(the StalePageException) is thrown and finally the exception mapper handles 
this expected exceptions (see DefaultExceptionMapper).

This means for a StalePageException that, after the StalePageException is 
thrown, the DefaultExceptionMapper redirects to the same page again.
{code:java}
// don't expose original exception by the WicketTester
tester.setExposeExceptions(false);
tester.getRequest().setURL(firstHRef);

boolean thrown = false;
try
{
   tester.processRequest();
}
catch (StalePageException e)
{
   thrown = true;
}
assertTrue( thrown );

// redirect to same page with 302
assertTrue(tester.getLastResponse().isRedirect());
assertFalse(tester.getLastResponse().getRedirectLocation().isEmpty());
tester.assertRenderedPage(StalePageExceptionPage.class);
assertEquals( HttpServletResponse.SC_MOVED_TEMPORARILY, 
tester.getLastResponse().getStatus() );

{code}
This test runs with Wicket 8.9.0 but not with 8.10.0

 

 

> StalePageException not thrown
> -----------------------------
>
>                 Key: WICKET-6910
>                 URL: https://issues.apache.org/jira/browse/WICKET-6910
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 8.10.0
>            Reporter: Dirk Forchel
>            Assignee: Sven Meier
>            Priority: Major
>         Attachments: myproject.zip
>
>
> In our wicket application we have a unit test that simulates a 
> StalePageException for a RequestCycleListener. This test no longer works as 
> expected since version 8.10.0. Prior to this version the test was working. 
> This test assumes that the StalePageException is thrown during the rendering 
> phase, but this is no longer the case. I'm not sure if this is a bug or if 
> the test setup has become wrong. 
> I'm also not sure if this issue is related to WICKET-6869. 
> Attached you will find a quick start with the StalePageExceptionTest.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to