Search in sources :

Example 1 with ResetResponseException

use of org.apache.wicket.request.flow.ResetResponseException in project wicket by apache.

the class DefaultPageFactoryTest method abortAndRespondContract.

/**
 * Verifies page factory bubbles ResetResponseException
 */
@Test
void abortAndRespondContract() {
    try {
        pageFactory.newPage(AbortAndRespondPage1.class);
        fail();
    } catch (ResetResponseException e) {
    // noop
    }
    try {
        pageFactory.newPage(AbortAndRespondPage2.class);
        fail();
    } catch (ResetResponseException e) {
    // noop
    }
    try {
        pageFactory.newPage(AbortAndRespondPage2.class, new PageParameters());
        fail();
    } catch (ResetResponseException e) {
    // noop
    }
    try {
        pageFactory.newPage(AbortAndRespondPage3.class);
        fail();
    } catch (ResetResponseException e) {
    // noop
    }
    try {
        pageFactory.newPage(AbortAndRespondPage3.class, new PageParameters());
        fail();
    } catch (ResetResponseException e) {
    // noop
    }
    try {
        pageFactory.newPage(PageThrowingCheckedException.class);
        fail();
    } catch (WicketRuntimeException e) {
        assertNotNull(e.getCause());
        assertNotNull(e.getCause().getCause());
        assertEquals(PageThrowingCheckedException.EXCEPTION, e.getCause().getCause());
    } catch (Exception e) {
        fail();
    }
}
Also used : WicketRuntimeException(org.apache.wicket.WicketRuntimeException) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) WicketRuntimeException(org.apache.wicket.WicketRuntimeException) ResetResponseException(org.apache.wicket.request.flow.ResetResponseException) ResetResponseException(org.apache.wicket.request.flow.ResetResponseException) Test(org.junit.jupiter.api.Test)

Aggregations

WicketRuntimeException (org.apache.wicket.WicketRuntimeException)1 ResetResponseException (org.apache.wicket.request.flow.ResetResponseException)1 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)1 Test (org.junit.jupiter.api.Test)1