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
2 changed files with 10 additions and 2 deletions
Showing only changes of commit 8721400226 - Show all commits

View File

@ -80,7 +80,7 @@ class HsOfficeScenarioTests extends ScenarioTest {
@Produces("Operations-Contact: Dennis Krause for Test AG")
void shouldAddOperationsContactToPartner() {
new AddOperationsContactToPartner(this)
.given("partnerPersonUuid", "%{Person: Test AG}")
.given("partnerPersonTradeName", "Test AG")
.given("operationsContactFamilyName", "Krause")
.given("operationsContactGivenName", "Dennis")
.given("operationsContactPhoneNumber", "+49 9932 587741")

View File

@ -7,6 +7,7 @@ import org.springframework.http.HttpStatus;
import static io.restassured.http.ContentType.JSON;
import static org.springframework.http.HttpStatus.CREATED;
import static org.springframework.http.HttpStatus.OK;
public class AddOperationsContactToPartner extends UseCase<AddOperationsContactToPartner> {
@ -16,6 +17,13 @@ public class AddOperationsContactToPartner extends UseCase<AddOperationsContactT
@Override
protected HttpResponse run() {
keep("Person: %{partnerPersonTradeName}", () ->
httpGet("/api/hs/office/persons?name=" + uriEncoded("%{partnerPersonTradeName}"))
.expecting(OK).expecting(JSON),
response -> response.expectArrayElements(1).getFromBody("[0].uuid")
);
keep("Person: %{operationsContactGivenName} %{operationsContactFamilyName}",
() ->
httpPost("/api/hs/office/persons", usingJsonBody("""
@ -49,7 +57,7 @@ public class AddOperationsContactToPartner extends UseCase<AddOperationsContactT
return httpPost("/api/hs/office/relations", usingJsonBody("""
{
"type": "OPERATIONS",
"anchorUuid": ${partnerPersonUuid},
"anchorUuid": ${Person: %{partnerPersonTradeName}},
"holderUuid": ${Person: %{operationsContactGivenName} %{operationsContactFamilyName}},
"contactUuid": ${Contact: %{operationsContactGivenName} %{operationsContactFamilyName}}
}