### Question:
CentralDogmaAuthFailureHandler implements AuthFailureHandler { @Override public HttpResponse authFailed(HttpService delegate, ServiceRequestContext ctx, HttpRequest req, @Nullable Throwable cause) throws Exception { if (cause != null) { if (!(cause instanceof ShuttingDownException)) { logger.warn("Unexpected exception during authorization:", cause); } return HttpApiUtil.newResponse(ctx, HttpStatus.INTERNAL_SERVER_ERROR, cause); } return HttpApiUtil.newResponse(ctx, HttpStatus.UNAUTHORIZED, AUTHORIZATION_EXCEPTION); }  @Override HttpResponse authFailed(HttpService delegate,
                                   ServiceRequestContext ctx, HttpRequest req,
                                   @Nullable Throwable cause);  }### Answer:
@Test void shuttingDown() throws Exception { final AggregatedHttpResponse res = handler.authFailed(delegate, ctx, req, new ShuttingDownException()) .aggregate().join(); assertThat(res.status()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR); assertThat(res.contentType()).isEqualTo(MediaType.JSON_UTF_8); assertThatJson(res.contentUtf8()).isEqualTo( '{' + " \"exception\": \"com.linecorp.centraldogma.common.ShuttingDownException\"," + " \"message\":\"\"" + '}'); }
@Test void failure() throws Exception { final AggregatedHttpResponse res = handler.authFailed(delegate, ctx, req, new Exception("oops")) .aggregate().join(); assertThat(res.status()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR); assertThat(res.contentType()).isEqualTo(MediaType.JSON_UTF_8); assertThatJson(res.contentUtf8()).isEqualTo( '{' + " \"exception\": \"java.lang.Exception\"," + " \"message\":\"oops\"" + '}'); }
@Test void incorrectToken() throws Exception { final AggregatedHttpResponse res = handler.authFailed(delegate, ctx, req, null) .aggregate().join(); assertThat(res.status()).isEqualTo(HttpStatus.UNAUTHORIZED); assertThat(res.contentType()).isEqualTo(MediaType.JSON_UTF_8); assertThatJson(res.contentUtf8()).isEqualTo( '{' + " \"exception\": \"com.linecorp.centraldogma.common.AuthorizationException\"," + " \"message\":\"\"" + '}'); }