feature/use-case-acceptance-tests #116
@ -103,7 +103,7 @@ public abstract class UseCase<T extends UseCase<?>> {
|
|||||||
.timeout(Duration.ofSeconds(10))
|
.timeout(Duration.ofSeconds(10))
|
||||||
.build();
|
.build();
|
||||||
final var response = client.send(request, BodyHandlers.ofString());
|
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
|
@SneakyThrows
|
||||||
@ -178,6 +178,7 @@ public abstract class UseCase<T extends UseCase<?>> {
|
|||||||
|
|
||||||
private UUID locationUuid;
|
private UUID locationUuid;
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
public HttpResponse(
|
public HttpResponse(
|
||||||
final HttpMethod httpMethod,
|
final HttpMethod httpMethod,
|
||||||
final String uri,
|
final String uri,
|
||||||
@ -199,10 +200,12 @@ public abstract class UseCase<T extends UseCase<?>> {
|
|||||||
}
|
}
|
||||||
printLine("```");
|
printLine("```");
|
||||||
printLine(httpMethod.name() + " " + uri);
|
printLine(httpMethod.name() + " " + uri);
|
||||||
printLine(requestBody + "=> status: " + status + " " +
|
printLine((requestBody != null ? requestBody : "") + "=> status: " + status + " " +
|
||||||
(locationUuid != null ? locationUuid : ""));
|
(locationUuid != null ? locationUuid : ""));
|
||||||
if (!status.is2xxSuccessful()) {
|
if (httpMethod == HttpMethod.GET || !status.is2xxSuccessful()) {
|
||||||
printLine(response.body()); // FIXME: prettyPrint
|
final var jsonNode = objectMapper.readTree(response.body());
|
||||||
|
final var prettyJson = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonNode);
|
||||||
|
printLine(prettyJson);
|
||||||
}
|
}
|
||||||
printLine("```");
|
printLine("```");
|
||||||
printLine("");
|
printLine("");
|
||||||
|
@ -20,6 +20,8 @@ public class CreateSelfDebitorForPartner extends UseCase<CreateSelfDebitorForPar
|
|||||||
.expecting(OK).expecting(JSON),
|
.expecting(OK).expecting(JSON),
|
||||||
response -> response.getFromBody("[0].holder.uuid")
|
response -> 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", () ->
|
keep("BankAccount: Test AG - refund bank account", () ->
|
||||||
httpPost("/api/hs/office/bankaccounts", usingJsonBody("""
|
httpPost("/api/hs/office/bankaccounts", usingJsonBody("""
|
||||||
|
Loading…
Reference in New Issue
Block a user