@Test public void testResultCreation() { Result result = new HttpException().toResult(); assertThat(result.getStatusCode()).isEqualTo(500); assertThat(result.getRenderable().content()).isEqualTo(""); result = new HttpException(418).toResult(); assertThat(result.getStatusCode()).isEqualTo(418); assertThat(result.getRenderable().content()).isEqualTo(""); result = new HttpException("bad").toResult(); assertThat(result.getStatusCode()).isEqualTo(500); assertThat(result.getRenderable().content()).isEqualTo("bad"); result = new HttpException("bad", new NullPointerException()).toResult(); assertThat(result.getStatusCode()).isEqualTo(500); assertThat(result.getRenderable().content()).isEqualTo("bad"); result = new HttpException(new NullPointerException()).toResult(); assertThat(result.getStatusCode()).isEqualTo(500); assertThat(result.getRenderable().content()).isEqualTo(""); result = new HttpException(418, new NullPointerException()).toResult(); assertThat(result.getStatusCode()).isEqualTo(418); assertThat(result.getRenderable().content()).isEqualTo(""); result = new HttpException(418, "bad").toResult(); assertThat(result.getStatusCode()).isEqualTo(418); assertThat(result.getRenderable().content()).isEqualTo("bad"); result = new HttpException(418, "bad", new NullPointerException()).toResult(); assertThat(result.getStatusCode()).isEqualTo(418); assertThat(result.getRenderable().content()).isEqualTo("bad"); }
public Result toResult() { return new Result().status(status).render(getMessage()); }
HttpException extends RuntimeException implements Status { public Result toResult() { return new Result().status(status).render(getMessage()); } }
HttpException extends RuntimeException implements Status { public Result toResult() { return new Result().status(status).render(getMessage()); } HttpException();  HttpException(int status);  HttpException(String message);  HttpException(String message, Throwable cause);  HttpException(Throwable cause);  HttpException(int status, Throwable cause);  HttpException(int status, String message);  HttpException(int status, String message, Throwable cause); }
HttpException extends RuntimeException implements Status { public Result toResult() { return new Result().status(status).render(getMessage()); } HttpException();  HttpException(int status);  HttpException(String message);  HttpException(String message, Throwable cause);  HttpException(Throwable cause);  HttpException(int status, Throwable cause);  HttpException(int status, String message);  HttpException(int status, String message, Throwable cause); Result toResult(); }
HttpException extends RuntimeException implements Status { public Result toResult() { return new Result().status(status).render(getMessage()); } HttpException();  HttpException(int status);  HttpException(String message);  HttpException(String message, Throwable cause);  HttpException(Throwable cause);  HttpException(int status, Throwable cause);  HttpException(int status, String message);  HttpException(int status, String message, Throwable cause); Result toResult();  }