fix postalAddress format in scenario tests

This commit is contained in:
Michael Hoennig 2024-11-05 18:54:39 +01:00
parent 626db1fa16
commit 48bc6c9ccf
8 changed files with 54 additions and 25 deletions

View File

@ -96,9 +96,9 @@ class HsOfficeContactPatcherUnitTest extends PatchUnitTestBase<
HsOfficeContactRbacEntity::setCaption), HsOfficeContactRbacEntity::setCaption),
new SimpleProperty<>( new SimpleProperty<>(
"postalAddress", "postalAddress",
HsOfficeContactPatchResource::setEmailAddresses, HsOfficeContactPatchResource::setPostalAddress,
PATCH_POSTAL_ADDRESS, PATCH_POSTAL_ADDRESS,
HsOfficeContactRbacEntity::putEmailAddresses, HsOfficeContactRbacEntity::putPhoneNumbers,
PATCHED_POSTAL_ADDRESS) PATCHED_POSTAL_ADDRESS)
.notNullable(), .notNullable(),
new SimpleProperty<>( new SimpleProperty<>(

View File

@ -460,10 +460,13 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu
"type": "DEBITOR", "type": "DEBITOR",
"contact": { "contact": {
"caption": "first contact", "caption": "first contact",
"postalAddress": "Vorname Nachname\\nStraße Hnr\\nPLZ Stadt", "postalAddress": {
"country": "Germany"
},
"emailAddresses": { "main": "contact-admin@firstcontact.example.com" }, "emailAddresses": { "main": "contact-admin@firstcontact.example.com" },
"phoneNumbers": { "phone_office": "+49 123 1234567" } "phoneNumbers": { "phone_office": "+49 123 1234567" }
} }
}
}, },
"debitorNumber": 1000111, "debitorNumber": 1000111,
"debitorNumberSuffix": "11", "debitorNumberSuffix": "11",
@ -476,10 +479,11 @@ class HsOfficeDebitorControllerAcceptanceTest extends ContextBasedTestWithCleanu
"mark": null, "mark": null,
"contact": { "contact": {
"caption": "first contact", "caption": "first contact",
"postalAddress": "Vorname Nachname\\nStraße Hnr\\nPLZ Stadt", "postalAddress": {
"country": "Germany"
},
"emailAddresses": { "main": "contact-admin@firstcontact.example.com" }, "emailAddresses": { "main": "contact-admin@firstcontact.example.com" },
"phoneNumbers": { "phone_office": "+49 123 1234567" } "phoneNumbers": { "phone_office": "+49 123 1234567" }
}
}, },
"details": { "details": {
"registrationOffice": "Hamburg", "registrationOffice": "Hamburg",

View File

@ -199,7 +199,9 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
"type": "REPRESENTATIVE", "type": "REPRESENTATIVE",
"contact": { "contact": {
"caption": "first contact", "caption": "first contact",
"postalAddress": "Vorname Nachname\\nStraße Hnr\\nPLZ Stadt", "postalAddress": {
"country": "Germany"
},
"emailAddresses": { "emailAddresses": {
"main": "contact-admin@firstcontact.example.com" "main": "contact-admin@firstcontact.example.com"
}, },

View File

@ -55,8 +55,11 @@ class HsOfficeScenarioTests extends ScenarioTest {
.given("tradeName", "Test AG") .given("tradeName", "Test AG")
.given("contactCaption", "Test AG - Hamburg") .given("contactCaption", "Test AG - Hamburg")
.given("postalAddress", """ .given("postalAddress", """
Shanghai-Allee 1 "firma": "Test AG",
20123 Hamburg "street": "Shanghai-Allee 1",
"zipcode": "20123",
"city": "Hamburg",
"country": "Germany"
""") """)
.given("officePhoneNumber", "+49 40 654321-0") .given("officePhoneNumber", "+49 40 654321-0")
.given("emailAddress", "hamburg@test-ag.example.org") .given("emailAddress", "hamburg@test-ag.example.org")
@ -75,8 +78,11 @@ class HsOfficeScenarioTests extends ScenarioTest {
.given("familyName", "Matthieu") .given("familyName", "Matthieu")
.given("contactCaption", "Michelle Matthieu") .given("contactCaption", "Michelle Matthieu")
.given("postalAddress", """ .given("postalAddress", """
An der Wandse 34 "name": "Michelle Matthieu",
22123 Hamburg "street": "An der Wandse 34",
"zipcode": "22123",
"city": "Hamburg",
"country": "Germany"
""") """)
.given("officePhoneNumber", "+49 40 123456") .given("officePhoneNumber", "+49 40 123456")
.given("emailAddress", "michelle.matthieu@example.org") .given("emailAddress", "michelle.matthieu@example.org")
@ -94,8 +100,11 @@ class HsOfficeScenarioTests extends ScenarioTest {
.given("representativeFamilyName", "Trust") .given("representativeFamilyName", "Trust")
.given("representativeGivenName", "Tracy") .given("representativeGivenName", "Tracy")
.given("representativePostalAddress", """ .given("representativePostalAddress", """
An der Alster 100 "name": "Michelle Matthieu",
20000 Hamburg "street": "An der Alster 100",
"zipcode": "20000",
"city": "Hamburg",
"country": "Germany"
""") """)
.given("representativePhoneNumber", "+49 40 123456") .given("representativePhoneNumber", "+49 40 123456")
.given("representativeEMailAddress", "tracy.trust@example.org") .given("representativeEMailAddress", "tracy.trust@example.org")
@ -172,12 +181,18 @@ class HsOfficeScenarioTests extends ScenarioTest {
void shouldReplaceContactData() { void shouldReplaceContactData() {
new ReplaceContactData(this) new ReplaceContactData(this)
.given("partnerName", "Test AG") .given("partnerName", "Test AG")
.given("newContactCaption", "Test AG - Norden") .given("newContactCaption", "Test AG - China")
.given("newPostalAddress", """ .given("newPostalAddress", """
Am Hafen 11 "firma": "Test AG",
26506 Norden "name": "Fi Zhong-Kha",
"building": "Thi Chi Koh Building",
"street": "No.2 Commercial Second Street",
"district": "Niushan Wei Wu",
"city": "Dongguan City",
"province": "Guangdong Province",
"country": "China"
""") """)
.given("newOfficePhoneNumber", "+49 4931 654321-0") .given("newOfficePhoneNumber", "++15 999 654321" )
.given("newEmailAddress", "norden@test-ag.example.org") .given("newEmailAddress", "norden@test-ag.example.org")
.doRun(); .doRun();
} }

View File

@ -27,7 +27,9 @@ public class AmendContactData extends UseCase<AmendContactData> {
httpPatch("/api/hs/office/contacts/%{partnerContactUuid}", usingJsonBody(""" httpPatch("/api/hs/office/contacts/%{partnerContactUuid}", usingJsonBody("""
{ {
"caption": ${newContactCaption???}, "caption": ${newContactCaption???},
"postalAddress": ${newPostalAddress???}, "postalAddress": {
%{newPostalAddress???}
},
"phoneNumbers": { "phoneNumbers": {
"office": ${newOfficePhoneNumber???} "office": ${newOfficePhoneNumber???}
}, },

View File

@ -27,7 +27,9 @@ public class ReplaceContactData extends UseCase<ReplaceContactData> {
httpPost("/api/hs/office/contacts", usingJsonBody(""" httpPost("/api/hs/office/contacts", usingJsonBody("""
{ {
"caption": ${newContactCaption}, "caption": ${newContactCaption},
"postalAddress": ${newPostalAddress???}, "postalAddress": {
%{newPostalAddress???}
},
"phoneNumbers": { "phoneNumbers": {
"phone": ${newOfficePhoneNumber???} "phone": ${newOfficePhoneNumber???}
}, },

View File

@ -42,7 +42,9 @@ public class AddRepresentativeToPartner extends UseCase<AddRepresentativeToPartn
httpPost("/api/hs/office/contacts", usingJsonBody(""" httpPost("/api/hs/office/contacts", usingJsonBody("""
{ {
"caption": "%{representativeGivenName} %{representativeFamilyName}", "caption": "%{representativeGivenName} %{representativeFamilyName}",
"postalAddress": ${representativePostalAddress}, "postalAddress": {
%{representativePostalAddress}
},
"phoneNumbers": { "phoneNumbers": {
"main": ${representativePhoneNumber} "main": ${representativePhoneNumber}
}, },

View File

@ -44,7 +44,9 @@ public class CreatePartner extends UseCase<CreatePartner> {
httpPost("/api/hs/office/contacts", usingJsonBody(""" httpPost("/api/hs/office/contacts", usingJsonBody("""
{ {
"caption": ${contactCaption}, "caption": ${contactCaption},
"postalAddress": ${postalAddress???}, "postalAddress": {
%{postalAddress???}
},
"phoneNumbers": { "phoneNumbers": {
"office": ${officePhoneNumber???} "office": ${officePhoneNumber???}
}, },