feature/use-case-acceptance-tests #116

Merged
hsh-michaelhoennig merged 49 commits from feature/use-case-acceptance-tests into master 2024-10-30 11:40:46 +01:00
6 changed files with 86 additions and 86 deletions
Showing only changes of commit 824565204d - Show all commits

View File

@ -21,26 +21,26 @@ public class CreateExternalDebitorForPartner extends UseCase<CreateExternalDebit
@Override @Override
protected HttpResponse run() { protected HttpResponse run() {
keep("BankAccount: Billing GmbH - refund bank account", () -> keep("BankAccount: Billing GmbH - refund bank account", () ->
httpPost("/api/hs/office/bankaccounts", usingJsonBody(""" httpPost("/api/hs/office/bankaccounts", usingJsonBody("""
{ {
"holder": "Billing GmbH - refund bank account", "holder": "Billing GmbH - refund bank account",
"iban": "DE02120300000000202051", "iban": "DE02120300000000202051",
"bic": "BYLADEM1001" "bic": "BYLADEM1001"
} }
""")) """))
.expecting(CREATED).expecting(JSON) .expecting(CREATED).expecting(JSON)
); );
keep("Contact: Billing GmbH - Test AG billing", () -> keep("Contact: Billing GmbH - Test AG billing", () ->
httpPost("/api/hs/office/contacts", usingJsonBody(""" httpPost("/api/hs/office/contacts", usingJsonBody("""
{ {
"caption": "Billing GmbH, billing for Test AG", "caption": "Billing GmbH, billing for Test AG",
"emailAddresses": { "emailAddresses": {
"main": "test-ag@billing-GmbH.example.com" "main": "test-ag@billing-GmbH.example.com"
}
} }
""")) }
.expecting(CREATED).expecting(JSON) """))
.expecting(CREATED).expecting(JSON)
); );
return httpPost("/api/hs/office/debitors", usingJsonBody(""" return httpPost("/api/hs/office/debitors", usingJsonBody("""

View File

@ -24,26 +24,26 @@ public class CreateSelfDebitorForPartner extends UseCase<CreateSelfDebitorForPar
); );
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("""
{ {
"holder": "Test AG - refund bank account", "holder": "Test AG - refund bank account",
"iban": "DE88100900001234567892", "iban": "DE88100900001234567892",
"bic": "BEVODEBB" "bic": "BEVODEBB"
} }
""")) """))
.expecting(CREATED).expecting(JSON) .expecting(CREATED).expecting(JSON)
); );
keep("Contact: Test AG - billing department", () -> keep("Contact: Test AG - billing department", () ->
httpPost("/api/hs/office/contacts", usingJsonBody(""" httpPost("/api/hs/office/contacts", usingJsonBody("""
{ {
"caption": ${billingContactCaption}, "caption": ${billingContactCaption},
"emailAddresses": { "emailAddresses": {
"main": ${billingContactEmailAddress} "main": ${billingContactEmailAddress}
}
} }
""")) }
.expecting(CREATED).expecting(JSON) """))
.expecting(CREATED).expecting(JSON)
); );
return httpPost("/api/hs/office/debitors", usingJsonBody(""" return httpPost("/api/hs/office/debitors", usingJsonBody("""

View File

@ -15,14 +15,14 @@ public class CreateSepaMandataForDebitor extends UseCase<CreateSepaMandataForDeb
@Override @Override
protected HttpResponse run() { protected HttpResponse run() {
keep("BankAccount: Test AG - debit bank account", () -> keep("BankAccount: Test AG - debit bank account", () ->
httpPost("/api/hs/office/bankaccounts", usingJsonBody(""" httpPost("/api/hs/office/bankaccounts", usingJsonBody("""
{ {
"holder": "Test AG - debit bank account", "holder": "Test AG - debit bank account",
"iban": "DE02701500000000594937", "iban": "DE02701500000000594937",
"bic": "SSKMDEMM" "bic": "SSKMDEMM"
} }
""")) """))
.expecting(CREATED).expecting(JSON) .expecting(CREATED).expecting(JSON)
); );
return httpPost("/api/hs/office/sepamandates", usingJsonBody(""" return httpPost("/api/hs/office/sepamandates", usingJsonBody("""

View File

@ -40,18 +40,18 @@ public class AddOperationsContactToPartner extends UseCase<AddOperationsContactT
); );
keep("Contact: %{operationsContactGivenName} %{operationsContactFamilyName}", () -> keep("Contact: %{operationsContactGivenName} %{operationsContactFamilyName}", () ->
httpPost("/api/hs/office/contacts", usingJsonBody(""" httpPost("/api/hs/office/contacts", usingJsonBody("""
{ {
"caption": "%{operationsContactGivenName} %{operationsContactFamilyName}", "caption": "%{operationsContactGivenName} %{operationsContactFamilyName}",
"phoneNumbers": { "phoneNumbers": {
"main": ${operationsContactPhoneNumber} "main": ${operationsContactPhoneNumber}
}, },
"emailAddresses": { "emailAddresses": {
"main": ${operationsContactEMailAddress} "main": ${operationsContactEMailAddress}
} }
} }
""")) """))
.expecting(CREATED).expecting(JSON), .expecting(CREATED).expecting(JSON),
"Please check first if that contact already exists, if so, use it's UUID below." "Please check first if that contact already exists, if so, use it's UUID below."
); );

View File

@ -1,8 +1,8 @@
package net.hostsharing.hsadminng.hs.office.scenarios.partner; package net.hostsharing.hsadminng.hs.office.scenarios.partner;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import static io.restassured.http.ContentType.JSON; import static io.restassured.http.ContentType.JSON;
@ -19,39 +19,39 @@ public class AddRepresentativeToPartner extends UseCase<AddRepresentativeToPartn
protected HttpResponse run() { protected HttpResponse run() {
keep("Person: %{partnerPersonTradeName}", () -> keep("Person: %{partnerPersonTradeName}", () ->
httpGet("/api/hs/office/persons?name=" + uriEncoded("%{partnerPersonTradeName}")) httpGet("/api/hs/office/persons?name=" + uriEncoded("%{partnerPersonTradeName}"))
.expecting(OK).expecting(JSON), .expecting(OK).expecting(JSON),
response -> response.expectArrayElements(1).getFromBody("[0].uuid"), response -> response.expectArrayElements(1).getFromBody("[0].uuid"),
"In production data this query could result in multiple outputs. In that case, you have to find out which is the right one." "In production data this query could result in multiple outputs. In that case, you have to find out which is the right one."
); );
keep("Person: %{representativeGivenName} %{representativeFamilyName}", () -> keep("Person: %{representativeGivenName} %{representativeFamilyName}", () ->
httpPost("/api/hs/office/persons", usingJsonBody(""" httpPost("/api/hs/office/persons", usingJsonBody("""
{ {
"personType": "NATURAL_PERSON", "personType": "NATURAL_PERSON",
"familyName": ${representativeFamilyName}, "familyName": ${representativeFamilyName},
"givenName": ${representativeGivenName} "givenName": ${representativeGivenName}
} }
""")) """))
.expecting(HttpStatus.CREATED).expecting(ContentType.JSON), .expecting(HttpStatus.CREATED).expecting(ContentType.JSON),
"Please check first if that person already exists, if so, use it's UUID below.", "Please check first if that person already exists, if so, use it's UUID below.",
"**HINT**: A representative is always a natural person and represents a non-natural-person." "**HINT**: A representative is always a natural person and represents a non-natural-person."
); );
keep("Contact: %{representativeGivenName} %{representativeFamilyName}", () -> keep("Contact: %{representativeGivenName} %{representativeFamilyName}", () ->
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}
}, },
"emailAddresses": { "emailAddresses": {
"main": ${representativeEMailAddress} "main": ${representativeEMailAddress}
}
} }
""")) }
.expecting(CREATED).expecting(JSON), """))
.expecting(CREATED).expecting(JSON),
"Please check first if that contact already exists, if so, use it's UUID below." "Please check first if that contact already exists, if so, use it's UUID below."
); );

View File

@ -17,7 +17,7 @@ public class SubscribeToMailinglist extends UseCase<SubscribeToMailinglist> {
@Override @Override
protected HttpResponse run() { protected HttpResponse run() {
keep("Person: %{subscriberGivenName} %{subscriberFamilyName}", () -> keep("Person: %{subscriberGivenName} %{subscriberFamilyName}", () ->
httpPost("/api/hs/office/persons", usingJsonBody(""" httpPost("/api/hs/office/persons", usingJsonBody("""
{ {
"personType": "NATURAL_PERSON", "personType": "NATURAL_PERSON",
"familyName": ${subscriberFamilyName}, "familyName": ${subscriberFamilyName},
@ -28,15 +28,15 @@ public class SubscribeToMailinglist extends UseCase<SubscribeToMailinglist> {
); );
keep("Contact: %{subscriberGivenName} %{subscriberFamilyName}", () -> keep("Contact: %{subscriberGivenName} %{subscriberFamilyName}", () ->
httpPost("/api/hs/office/contacts", usingJsonBody(""" httpPost("/api/hs/office/contacts", usingJsonBody("""
{ {
"caption": "%{subscriberGivenName} %{subscriberFamilyName}", "caption": "%{subscriberGivenName} %{subscriberFamilyName}",
"emailAddresses": { "emailAddresses": {
"main": ${subscriberEMailAddress} "main": ${subscriberEMailAddress}
}
} }
""")) }
.expecting(CREATED).expecting(JSON) """))
.expecting(CREATED).expecting(JSON)
); );
return httpPost("/api/hs/office/relations", usingJsonBody(""" return httpPost("/api/hs/office/relations", usingJsonBody("""