Example usage for org.apache.wicket.request.http.flow AbortWithHttpErrorCodeException getErrorCode

List of usage examples for org.apache.wicket.request.http.flow AbortWithHttpErrorCodeException getErrorCode

Introduction

In this page you can find the example usage for org.apache.wicket.request.http.flow AbortWithHttpErrorCodeException getErrorCode.

Prototype

public int getErrorCode() 

Source Link

Document

Gets the error code.

Usage

From source file:fiftyfive.wicket.util.ParameterSpecTest.java

License:Apache License

/**
 * Asserts that badly formatted page parameter value causes an abort
 * with 404./*  w  w  w  .  j  a v a2 s .c  om*/
 */
@Test
public void testParseParameters_badformat404() {
    ParameterSpec builder = new ParameterSpec<TestBean>(TestPage.class, "id", "name");

    TestBean bean = new TestBean();
    PageParameters params = new PageParameters();
    params.set("id", "notparseableaslong");

    try {
        builder.parseParameters(params, bean);
        Assert.fail("AbortWithHttpErrorCodeException was not thrown.");
    } catch (AbortWithHttpErrorCodeException awhece) {
        Assert.assertEquals(404, awhece.getErrorCode());
    }
}