diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/UseCase.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/UseCase.java index c5b319da..189f4ee9 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/UseCase.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/UseCase.java @@ -103,7 +103,7 @@ public abstract class UseCase> { .timeout(Duration.ofSeconds(10)) .build(); final var response = client.send(request, BodyHandlers.ofString()); - return new HttpResponse(HttpMethod.POST, uriPath, null, response); + return new HttpResponse(HttpMethod.GET, uriPath, null, response); } @SneakyThrows @@ -178,6 +178,7 @@ public abstract class UseCase> { private UUID locationUuid; + @SneakyThrows public HttpResponse( final HttpMethod httpMethod, final String uri, @@ -199,10 +200,12 @@ public abstract class UseCase> { } printLine("```"); printLine(httpMethod.name() + " " + uri); - printLine(requestBody + "=> status: " + status + " " + + printLine((requestBody != null ? requestBody : "") + "=> status: " + status + " " + (locationUuid != null ? locationUuid : "")); - if (!status.is2xxSuccessful()) { - printLine(response.body()); // FIXME: prettyPrint + if (httpMethod == HttpMethod.GET || !status.is2xxSuccessful()) { + final var jsonNode = objectMapper.readTree(response.body()); + final var prettyJson = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonNode); + printLine(prettyJson); } printLine("```"); printLine(""); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateSelfDebitorForPartner.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateSelfDebitorForPartner.java index ebfa6e4b..2fa18d7c 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateSelfDebitorForPartner.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateSelfDebitorForPartner.java @@ -20,6 +20,8 @@ public class CreateSelfDebitorForPartner extends UseCase response.getFromBody("[0].holder.uuid") ); + printPara("From that output above, we're taking the UUID of the holder of the first result element."); + printPara("**HINT**: With production data, you might get multiple results and have to decide which is the right one."); keep("BankAccount: Test AG - refund bank account", () -> httpPost("/api/hs/office/bankaccounts", usingJsonBody("""