Compare commits
No commits in common. "ff275ec4f313c3a409a6fb67b96442a774d816ea" and "33ceebf1d7cf61f62cdac02f9c078bb88018b05f" have entirely different histories.
ff275ec4f3
...
33ceebf1d7
@ -2,7 +2,6 @@ package net.hostsharing.hsadminng.hs.office.scenarios;
|
|||||||
|
|
||||||
import net.hostsharing.hsadminng.HsadminNgApplication;
|
import net.hostsharing.hsadminng.HsadminNgApplication;
|
||||||
import net.hostsharing.hsadminng.hs.office.scenarios.contact.AmendContactData;
|
import net.hostsharing.hsadminng.hs.office.scenarios.contact.AmendContactData;
|
||||||
import net.hostsharing.hsadminng.hs.office.scenarios.contact.ReplaceContactData;
|
|
||||||
import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateExternalDebitorForPartner;
|
import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateExternalDebitorForPartner;
|
||||||
import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateSelfDebitorForPartner;
|
import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateSelfDebitorForPartner;
|
||||||
import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateSepaMandateForDebitor;
|
import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateSepaMandateForDebitor;
|
||||||
@ -45,19 +44,19 @@ class HsOfficeScenarioTests extends ScenarioTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(1010)
|
@Order(1010)
|
||||||
@Produces(explicitly = "Partner: Test AG", implicitly = {"Person: Test AG", "Contact: Test AG - Hamburg"})
|
@Produces(explicitly = "Partner: Test AG", implicitly = {"Person: Test AG", "Contact: Test AG - Board of Directors"})
|
||||||
void shouldCreateLegalPersonAsPartner() {
|
void shouldCreateLegalPersonAsPartner() {
|
||||||
new CreatePartner(this)
|
new CreatePartner(this)
|
||||||
.given("partnerNumber", 31010)
|
.given("partnerNumber", 31010)
|
||||||
.given("personType", "LEGAL_PERSON")
|
.given("personType", "LEGAL_PERSON")
|
||||||
.given("tradeName", "Test AG")
|
.given("tradeName", "Test AG")
|
||||||
.given("contactCaption", "Test AG - Hamburg")
|
.given("contactCaption", "Test AG - Board of Directors")
|
||||||
.given("postalAddress", """
|
.given("postalAddress", """
|
||||||
Shanghai-Allee 1
|
Shanghai-Allee 1
|
||||||
20123 Hamburg
|
20123 Hamburg
|
||||||
""")
|
""")
|
||||||
.given("officePhoneNumber", "+49 40 654321-0")
|
.given("officePhoneNumber", "+49 40 654321-0")
|
||||||
.given("emailAddress", "hamburg@test-ag.example.org")
|
.given("emailAddress", "board-of-directors@test-ag.example.org")
|
||||||
.doRun()
|
.doRun()
|
||||||
.keep();
|
.keep();
|
||||||
}
|
}
|
||||||
@ -135,27 +134,17 @@ class HsOfficeScenarioTests extends ScenarioTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(1100)
|
@Order(1100)
|
||||||
@Requires("Partner: Michelle Matthieu")
|
|
||||||
void shouldAmendContactData() {
|
void shouldAmendContactData() {
|
||||||
new AmendContactData(this)
|
new AmendContactData(this)
|
||||||
.given("partnerName", "Matthieu")
|
.given("partnerNumber", 31020)
|
||||||
.given("newEmailAddress", "michelle@matthieu.example.org")
|
|
||||||
.doRun();
|
.doRun();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(1101)
|
@Order(1101)
|
||||||
@Requires("Partner: Test AG")
|
|
||||||
void shouldReplaceContactData() {
|
void shouldReplaceContactData() {
|
||||||
new ReplaceContactData(this)
|
new UseCaseNotImplementedYet(this)
|
||||||
.given("partnerName", "Test AG")
|
.given("partnerNumber", 31020)
|
||||||
.given("newContactCaption", "Test AG - Norden")
|
|
||||||
.given("newPostalAddress", """
|
|
||||||
Am Hafen 11
|
|
||||||
26506 Norden
|
|
||||||
""")
|
|
||||||
.given("newOfficePhoneNumber", "+49 4931 654321-0")
|
|
||||||
.given("newEmailAddress", "norden@test-ag.example.org")
|
|
||||||
.doRun();
|
.doRun();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,10 +2,8 @@ package net.hostsharing.hsadminng.hs.office.scenarios.contact;
|
|||||||
|
|
||||||
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 net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
|
|
||||||
import static io.restassured.http.ContentType.JSON;
|
import static org.assertj.core.api.Assumptions.assumeThat;
|
||||||
import static org.springframework.http.HttpStatus.OK;
|
|
||||||
|
|
||||||
public class AmendContactData extends UseCase<AmendContactData> {
|
public class AmendContactData extends UseCase<AmendContactData> {
|
||||||
|
|
||||||
@ -15,28 +13,7 @@ public class AmendContactData extends UseCase<AmendContactData> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected HttpResponse run() {
|
protected HttpResponse run() {
|
||||||
|
assumeThat(false).isTrue(); // makes the test gray
|
||||||
obtain("partnerContactuid", () ->
|
|
||||||
httpGet("/api/hs/office/relations?relationType=PARTNER&personData=" + uriEncoded("%{partnerName}"))
|
|
||||||
.expecting(OK).expecting(JSON),
|
|
||||||
response -> response.expectArrayElements(1).getFromBody("[0].contact.uuid"),
|
|
||||||
"In production data this query could result in multiple outputs. In that case, you have to find out which is the right one."
|
|
||||||
);
|
|
||||||
|
|
||||||
httpPatch("/api/hs/office/contacts/%{partnerContactuid}", usingJsonBody("""
|
|
||||||
{
|
|
||||||
"caption": ${newContactCaption???},
|
|
||||||
"postalAddress": ${newPostalAddress???},
|
|
||||||
"phoneNumbers": {
|
|
||||||
"office": ${newOfficePhoneNumber???}
|
|
||||||
},
|
|
||||||
"emailAddresses": {
|
|
||||||
"main": ${newEmailAddress???}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"""))
|
|
||||||
.expecting(HttpStatus.OK);
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
package net.hostsharing.hsadminng.hs.office.scenarios.contact;
|
|
||||||
|
|
||||||
import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
|
|
||||||
import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
|
|
||||||
|
|
||||||
import static io.restassured.http.ContentType.JSON;
|
|
||||||
import static org.springframework.http.HttpStatus.CREATED;
|
|
||||||
import static org.springframework.http.HttpStatus.OK;
|
|
||||||
|
|
||||||
public class ReplaceContactData extends UseCase<ReplaceContactData> {
|
|
||||||
|
|
||||||
public ReplaceContactData(final ScenarioTest testSuite) {
|
|
||||||
super(testSuite);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected HttpResponse run() {
|
|
||||||
|
|
||||||
obtain("partnerRelationUuid", () ->
|
|
||||||
httpGet("/api/hs/office/relations?relationType=PARTNER&personData=" + uriEncoded("%{partnerName}"))
|
|
||||||
.expecting(OK).expecting(JSON),
|
|
||||||
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."
|
|
||||||
);
|
|
||||||
|
|
||||||
obtain("Contact: %{newContactCaption}", () ->
|
|
||||||
httpPost("/api/hs/office/contacts", usingJsonBody("""
|
|
||||||
{
|
|
||||||
"caption": ${newContactCaption},
|
|
||||||
"postalAddress": ${newPostalAddress???},
|
|
||||||
"phoneNumbers": {
|
|
||||||
"phone": ${newOfficePhoneNumber???}
|
|
||||||
},
|
|
||||||
"emailAddresses": {
|
|
||||||
"main": ${newEmailAddress???}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"""))
|
|
||||||
.expecting(CREATED).expecting(JSON),
|
|
||||||
"Please check first if that contact already exists, if so, use it's UUID below."
|
|
||||||
);
|
|
||||||
|
|
||||||
httpPatch("/api/hs/office/relations/%{partnerRelationUuid}", usingJsonBody("""
|
|
||||||
{
|
|
||||||
"contactUuid": ${Contact: %{newContactCaption}}
|
|
||||||
}
|
|
||||||
"""))
|
|
||||||
.expecting(OK);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,7 +19,8 @@ public class CreateSelfDebitorForPartner extends UseCase<CreateSelfDebitorForPar
|
|||||||
httpGet("/api/hs/office/relations?relationType=PARTNER&personData=" + uriEncoded("%{partnerPersonTradeName}"))
|
httpGet("/api/hs/office/relations?relationType=PARTNER&personData=" + uriEncoded("%{partnerPersonTradeName}"))
|
||||||
.expecting(OK).expecting(JSON),
|
.expecting(OK).expecting(JSON),
|
||||||
response -> response.expectArrayElements(1).getFromBody("[0].holder.uuid"),
|
response -> response.expectArrayElements(1).getFromBody("[0].holder.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.",
|
||||||
|
"**HINT**: With production data, you might get multiple results and have to decide which is the right one."
|
||||||
);
|
);
|
||||||
|
|
||||||
obtain("BankAccount: Test AG - refund bank account", () ->
|
obtain("BankAccount: Test AG - refund bank account", () ->
|
||||||
|
Loading…
Reference in New Issue
Block a user