### Question:
ThreeScaleAdapterHandler implements MiddlewareHandler { @Override public void handleRequest(HttpServerExchange exchange) { CorrelationHandler.setupMDC(exchange); try { tryHandleRequest(exchange); } catch (Exception e) { LOG.error(APIM_6006.pattern(), e); replyWithErrorMessage( exchange, "Unexpected Internal Server Error occurred", HttpStatus.SC_INTERNAL_SERVER_ERROR); } } ThreeScaleAdapterHandler(); @Override void handleRequest(HttpServerExchange exchange); @Override HttpHandler getNext(); @Override MiddlewareHandler setNext(HttpHandler httpHandler); @Override boolean isEnabled(); @Override void register();  }### Answer:
@Test public void whenErrorFromBackendNoOrigin_ThenNoCorsReturned() { mockUnauthorized(); testee.handleRequest(exchange); verify(exchange).setStatusCode(eq(UNAUTHORIZED)); assertThat(responseHeaderMap.size(), is(0)); }
@Test public void whenErrorFromBackendWithOrigin_ThenCorsReturned() { mockUnauthorized(); String origin = "http: requestHeaderMap.add(HttpString.tryFromString("origin"), origin); testee.handleRequest(exchange); verify(exchange).setStatusCode(eq(UNAUTHORIZED)); assertThat(responseHeaderMap.size(), is(1)); assertThat(responseHeaderMap.get(HttpString.tryFromString("Access-Control-Allow-Origin")).getFirst(), is(origin)); }