public CompletableFuture<URL> newLRA(Exchange exchange) {
        HttpRequest request = prepareRequest(URI.create(lraUrl + COORDINATOR_PATH_START), exchange)
                .POST(HttpRequest.BodyPublishers.ofString(""))
                .build();

        CompletableFuture<HttpResponse<String>> future = client.sendAsync(request, HttpResponse.BodyHandlers.ofString());

        return future.thenApply(res -> {
            if (res.statusCode() >= HttpURLConnection.HTTP_BAD_REQUEST) {
                LOG.debug("LRA coordinator responded with error code {}. Message: {}", res.statusCode(), res.body());
                throw new IllegalStateException(
                        "Cannot obtain LRA id from LRA coordinator due to response status code " + res.statusCode());
            }

            // See if there's a location header containing the LRA URL
            List<String> location = res.headers().map().get("Location");
            if (ObjectHelper.isNotEmpty(location)) {
                return toURL(location.get(0));
            }

            // If there's no location header try the Long-Running-Action header, assuming there's only one present in the response
            List<String> lraHeaders = res.headers().map().get(Exchange.SAGA_LONG_RUNNING_ACTION);
            if (ObjectHelper.isNotEmpty(lraHeaders) && lraHeaders.size() == 1) {
                return toURL(lraHeaders.get(0));
            }

            // Fallback to reading the URL from the response body
            String responseBody = res.body();
            if (ObjectHelper.isNotEmpty(responseBody)) {
                return toURL(responseBody);
            }

            throw new IllegalStateException("Cannot obtain LRA id from LRA coordinator");
        });
    }
@DisplayName("Tests whether LRAClient is calling prepareRequest with exchange from newLRA()")
    @Test
    void testCallsPrepareRequestWithExchangeInNewLra() {
        LRASagaService sagaService = new LRASagaService();
        applyMockProperties(sagaService);
        LRAClient client = new LRAClient(sagaService) {
            protected HttpRequest.Builder prepareRequest(URI uri, Exchange exchange) {
                throw new ExchangeRuntimeException(exchange);
            }
        };
        Exchange exchange = Mockito.mock(Exchange.class);
        Assertions.assertThrows(ExchangeRuntimeException.class, () -> client.newLRA(exchange));
    }