From e4e509a23a1843e0eb4fa6659a9754eeb79fc652 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 6 Dec 2024 16:19:09 +0100 Subject: [PATCH] verify community of heirs to be the new holder of the partnerRel - currently failing --- .../ReplaceDeceasedPartnerWithCommunityOfHeirs.java | 7 ++++--- .../net/hostsharing/hsadminng/hs/scenarios/UseCase.java | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/ReplaceDeceasedPartnerWithCommunityOfHeirs.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/ReplaceDeceasedPartnerWithCommunityOfHeirs.java index de5b45b0..c2b5966e 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/ReplaceDeceasedPartnerWithCommunityOfHeirs.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/ReplaceDeceasedPartnerWithCommunityOfHeirs.java @@ -76,9 +76,10 @@ public class ReplaceDeceasedPartnerWithCommunityOfHeirs extends UseCase.HttpResponse response) { verify( - "Verify the New Partner Relation", - () -> httpGet("/api/hs/office/relations?relationType=PARTNER&contactData=Erbengemeinschaft%20&{nameOfDeceasedPerson}") - .expecting(OK).expecting(JSON).expectArrayElements(1) + "Verify the Updated Partner", + () -> httpGet("/api/hs/office/partners/%{partnerNumber}") + .expecting(OK).expecting(JSON).expectObject(), + path("partnerRel.holder.tradeName").contains("Erbengemeinschaft %{nameOfDeceasedPerson}") ); } } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/scenarios/UseCase.java b/src/test/java/net/hostsharing/hsadminng/hs/scenarios/UseCase.java index 7b438134..5da51293 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/scenarios/UseCase.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/scenarios/UseCase.java @@ -335,6 +335,13 @@ public abstract class UseCase> { return this; } + @SneakyThrows + public HttpResponse expectObject() { + final var rootNode = objectMapper.readTree(response.body()); + assertThat(rootNode.isArray()).as("object expected, but got array: " + response.body()).isFalse(); + return this; + } + @SneakyThrows public V getFromBody(final String path) { final var body = response.body();