### Question:
TokenEndpointResource extends ServerResource { @Override protected void doCatch(Throwable throwable) { exceptionHandler.handle(throwable, getResponse()); } @Inject  TokenEndpointResource(OAuth2RequestFactory<?, Request> requestFactory, AccessTokenService accessTokenService,
            ExceptionHandler exceptionHandler, Set<TokenRequestHook> hooks,
            JacksonRepresentationFactory jacksonRepresentationFactory); @Post Representation token(Representation entity);  }### Answer:
@Test public void shouldThrowServerErrorForExceptionsThatAreNotOAuth2RestletExceptions() { Context context = new Context(); Request request = new Request(); Response response = new Response(request); tokenEndpointResource.init(context, request, response); tokenEndpointResource.doCatch(new NullPointerException()); assertEquals(response.getStatus(), Status.CLIENT_ERROR_BAD_REQUEST); assertEquals(response.getEntityAsText(), "{\"error\":\"server_error\"}"); }