use of io.javalin.util.TypedException in project javalin by tipsy.
the class TestExceptionMapper method test_typedMappedException_isHandled.
@Test
public void test_typedMappedException_isHandled() throws Exception {
app.get("/typed-exception", ctx -> {
throw new TypedException();
}).exception(TypedException.class, (e, ctx) -> {
ctx.result(e.proofOfType());
});
HttpResponse<String> response = GET_asString("/typed-exception");
assertThat(response.getBody(), is("I'm so typed"));
assertThat(response.getStatus(), is(200));
}
Aggregations