RootRouteExceptionHandler { private Route handleDittoRuntimeException(final DittoRuntimeException dittoRuntimeException) { logException(dittoRuntimeException); return Directives.complete(dreToHttpResponse.apply(dittoRuntimeException)); } private  RootRouteExceptionHandler(final Function<DittoRuntimeException, HttpResponse> dreToHttpResponse); static ExceptionHandler getInstance(
            final Function<DittoRuntimeException, HttpResponse> dittoRuntimeExceptionToHttpResponse);  }
@Test public void handleDittoRuntimeException() { final DittoHeaders dittoHeaders = DittoHeaders.newBuilder() .correlationId(testName.getMethodName()) .build(); final GatewayMethodNotAllowedException exception = GatewayMethodNotAllowedException.newBuilder("GET") .dittoHeaders(dittoHeaders) .build(); final TestRoute testRoute = getTestRoute(() -> { throw exception; }); testRoute.run(HTTP_REQUEST); Mockito.verify(dreToHttpResponse).apply(Mockito.eq(exception)); }