From 966ac662cd62bc069f9129b0983e64602ca84a5d Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Wed, 18 Dec 2024 10:26:19 +0100 Subject: [PATCH] fetch nameOfDeceasedPerson from partnerrel.holder-person --- .../scenarios/HsOfficeScenarioTests.java | 1 - ...ceDeceasedPartnerWithCommunityOfHeirs.java | 31 ++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/HsOfficeScenarioTests.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/HsOfficeScenarioTests.java index 220dc0dd..f3037336 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/HsOfficeScenarioTests.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/HsOfficeScenarioTests.java @@ -621,7 +621,6 @@ class HsOfficeScenarioTests extends ScenarioTest { void shouldReplaceDeceasedPartnerByCommunityOfHeirs() { new ReplaceDeceasedPartnerWithCommunityOfHeirs(scenarioTest) .given("partnerNumber", "P-31011") - .given("nameOfDeceasedPerson", "Michelle Matthieu") // FIXME: redundant .given("dateOfDeath", "2024-11-15") .given("representativeGivenName", "Lena") .given("representativeFamilyName", "Stadland") 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 8aa535ca..c706e8e6 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 @@ -30,21 +30,24 @@ public class ReplaceDeceasedPartnerWithCommunityOfHeirs extends UseCase response.getFromBody("uuid"), "Even in production data we expect this query to return just a single result." // TODO.impl: add constraint? - ).extractValue("partnerRel.holder.uuid", "Person: %{nameOfDeceasedPerson}"); + ) + .extractValue("partnerRel.holder.familyName", "familyNameOfDeceasedPerson") + .extractValue("partnerRel.holder.givenName", "givenNameOfDeceasedPerson") + .extractUuidAlias("partnerRel.holder.uuid", "Person: %{givenNameOfDeceasedPerson} %{familyNameOfDeceasedPerson}"); - obtain("Partner-Relation: Erbengemeinschaft %{nameOfDeceasedPerson}", () -> + obtain("Partner-Relation: Erbengemeinschaft %{givenNameOfDeceasedPerson} %{familyNameOfDeceasedPerson}", () -> httpPost("/api/hs/office/relations", usingJsonBody(""" { "type": "PARTNER", "anchor.uuid": ${Person: Hostsharing eG}, "holder": { "personType": "UNINCORPORATED_FIRM", - "tradeName": "Erbengemeinschaft %{nameOfDeceasedPerson}", + "tradeName": "Erbengemeinschaft %{givenNameOfDeceasedPerson} %{familyNameOfDeceasedPerson}", }, "contact": { - "caption": "Erbengemeinschaft %{nameOfDeceasedPerson}", + "caption": "Erbengemeinschaft %{givenNameOfDeceasedPerson} %{familyNameOfDeceasedPerson}", "postalAddress": { - "name": "Erbengemeinschaft %{nameOfDeceasedPerson}", + "name": "Erbengemeinschaft %{givenNameOfDeceasedPerson} %{familyNameOfDeceasedPerson}", "co": "%{representativeGivenName} %{representativeFamilyName}", %{communityOfHeirsPostalAddress} }, @@ -59,29 +62,29 @@ public class ReplaceDeceasedPartnerWithCommunityOfHeirs extends UseCase + obtain("Representative-Relation: %{representativeGivenName} %{representativeFamilyName} for Erbengemeinschaft %{givenNameOfDeceasedPerson} %{familyNameOfDeceasedPerson}", () -> httpPost("/api/hs/office/relations", usingJsonBody(""" { "type": "REPRESENTATIVE", - "anchor.uuid": ${Person: Erbengemeinschaft %{nameOfDeceasedPerson}}, + "anchor.uuid": ${Person: Erbengemeinschaft %{givenNameOfDeceasedPerson} %{familyNameOfDeceasedPerson}}, "holder": { "personType": "NATURAL_PERSON", "givenName": ${representativeGivenName}, "familyName": ${representativeFamilyName} }, - "contact.uuid": ${Contact: Erbengemeinschaft %{nameOfDeceasedPerson}} + "contact.uuid": ${Contact: Erbengemeinschaft %{givenNameOfDeceasedPerson} %{familyNameOfDeceasedPerson}} } """)) .reportWithResponse().expecting(CREATED).expecting(JSON) ).extractUuidAlias("holder.uuid", "Person: %{representativeGivenName} %{representativeFamilyName}"); - obtain("Partner: Erbengemeinschaft %{nameOfDeceasedPerson}", () -> + obtain("Partner: Erbengemeinschaft %{givenNameOfDeceasedPerson} %{familyNameOfDeceasedPerson}", () -> httpPatch("/api/hs/office/partners/%{Partner: %{partnerNumber}}", usingJsonBody(""" { - "partnerRel.uuid": ${Partner-Relation: Erbengemeinschaft %{nameOfDeceasedPerson}} + "partnerRel.uuid": ${Partner-Relation: Erbengemeinschaft %{givenNameOfDeceasedPerson} %{familyNameOfDeceasedPerson}} } """)) .expecting(HttpStatus.OK) @@ -117,7 +120,7 @@ public class ReplaceDeceasedPartnerWithCommunityOfHeirs extends UseCase httpGet("/api/hs/office/partners/%{partnerNumber}") .expecting(OK).expecting(JSON).expectObject(), - path("partnerRel.holder.tradeName").contains("Erbengemeinschaft %{nameOfDeceasedPerson}") + path("partnerRel.holder.tradeName").contains("Erbengemeinschaft %{givenNameOfDeceasedPerson} %{familyNameOfDeceasedPerson}") ); // TODO.test: Verify the EX_PARTNER-Relation, once we fixed the anchor problem, see HsOfficePartnerController @@ -127,7 +130,7 @@ public class ReplaceDeceasedPartnerWithCommunityOfHeirs extends UseCase httpGet("/api/hs/office/relations?relationType=REPRESENTATIVE&personUuid=%{Person: %{representativeGivenName} %{representativeFamilyName}}") .expecting(OK).expecting(JSON).expectArrayElements(1), - path("[0].anchor.tradeName").contains("Erbengemeinschaft %{nameOfDeceasedPerson}"), + path("[0].anchor.tradeName").contains("Erbengemeinschaft %{givenNameOfDeceasedPerson} %{familyNameOfDeceasedPerson}"), path("[0].holder.familyName").contains("%{representativeFamilyName}") );