explicitly fetch Test AG in CreateExternalDebitorForPartner
This commit is contained in:
parent
47ba0cadb6
commit
619e5f288c
@ -132,7 +132,7 @@ class HsOfficeScenarioTests extends ScenarioTest {
|
|||||||
@Produces("Debitor: Billing GmbH")
|
@Produces("Debitor: Billing GmbH")
|
||||||
void shouldCreateExternalDebitorForPartner() {
|
void shouldCreateExternalDebitorForPartner() {
|
||||||
new CreateExternalDebitorForPartner(this)
|
new CreateExternalDebitorForPartner(this)
|
||||||
.given("partnerPersonUuid", "%{Person: Test AG}")
|
.given("partnerPersonTradeName", "Test AG")
|
||||||
.given("billingContactCaption", "Billing GmbH - billing department")
|
.given("billingContactCaption", "Billing GmbH - billing department")
|
||||||
.given("billingContactEmailAddress", "billing@test-ag.example.org")
|
.given("billingContactEmailAddress", "billing@test-ag.example.org")
|
||||||
.given("debitorNumberSuffix", "01")
|
.given("debitorNumberSuffix", "01")
|
||||||
|
@ -30,7 +30,8 @@ public class TestReport {
|
|||||||
final var testMethodOrder = testInfo.getTestMethod().map(m -> m.getAnnotation(Order.class).value()).orElseThrow();
|
final var testMethodOrder = testInfo.getTestMethod().map(m -> m.getAnnotation(Order.class).value()).orElseThrow();
|
||||||
assertThat(new File("doc/scenarios/").isDirectory() || new File("doc/scenarios/").mkdirs()).as("mkdir doc/scenarios/").isTrue();
|
assertThat(new File("doc/scenarios/").isDirectory() || new File("doc/scenarios/").mkdirs()).as("mkdir doc/scenarios/").isTrue();
|
||||||
markdownReport = new PrintWriter(new FileWriter("doc/scenarios/" + testMethodOrder + "-" + testMethodName + ".md"));
|
markdownReport = new PrintWriter(new FileWriter("doc/scenarios/" + testMethodOrder + "-" + testMethodName + ".md"));
|
||||||
print("## Scenario: " + testMethodName.replaceAll("([a-z])([A-Z]+)", "$1 $2"));
|
print("## Scenario #" + testInfo.getTestMethod().map(TestReport::orderNumber).orElseThrow() + ": " +
|
||||||
|
testMethodName.replaceAll("([a-z])([A-Z]+)", "$1 $2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
@ -59,6 +60,10 @@ public class TestReport {
|
|||||||
markdownReport.close();
|
markdownReport.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Object orderNumber(final Method method) {
|
||||||
|
return method.getAnnotation(Order.class).value();
|
||||||
|
}
|
||||||
|
|
||||||
private String appendUUIDKey(String multilineText) {
|
private String appendUUIDKey(String multilineText) {
|
||||||
final var lines = multilineText.split("\\r?\\n");
|
final var lines = multilineText.split("\\r?\\n");
|
||||||
final var result = new StringBuilder();
|
final var result = new StringBuilder();
|
||||||
|
@ -6,6 +6,7 @@ import net.hostsharing.hsadminng.hs.office.scenarios.person.CreatePerson;
|
|||||||
|
|
||||||
import static io.restassured.http.ContentType.JSON;
|
import static io.restassured.http.ContentType.JSON;
|
||||||
import static org.springframework.http.HttpStatus.CREATED;
|
import static org.springframework.http.HttpStatus.CREATED;
|
||||||
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
|
||||||
public class CreateExternalDebitorForPartner extends UseCase<CreateExternalDebitorForPartner> {
|
public class CreateExternalDebitorForPartner extends UseCase<CreateExternalDebitorForPartner> {
|
||||||
|
|
||||||
@ -20,6 +21,14 @@ public class CreateExternalDebitorForPartner extends UseCase<CreateExternalDebit
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected HttpResponse run() {
|
protected HttpResponse run() {
|
||||||
|
|
||||||
|
obtain("Person: %{partnerPersonTradeName}", () ->
|
||||||
|
httpGet("/api/hs/office/persons?name=" + uriEncoded("%{partnerPersonTradeName}"))
|
||||||
|
.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("BankAccount: Billing GmbH - refund bank account", () ->
|
obtain("BankAccount: Billing GmbH - refund bank account", () ->
|
||||||
httpPost("/api/hs/office/bankaccounts", usingJsonBody("""
|
httpPost("/api/hs/office/bankaccounts", usingJsonBody("""
|
||||||
{
|
{
|
||||||
@ -46,7 +55,7 @@ public class CreateExternalDebitorForPartner extends UseCase<CreateExternalDebit
|
|||||||
return httpPost("/api/hs/office/debitors", usingJsonBody("""
|
return httpPost("/api/hs/office/debitors", usingJsonBody("""
|
||||||
{
|
{
|
||||||
"debitorRel": {
|
"debitorRel": {
|
||||||
"anchorUuid": ${partnerPersonUuid},
|
"anchorUuid": ${Person: %{partnerPersonTradeName}},
|
||||||
"holderUuid": ${Person: Billing GmbH},
|
"holderUuid": ${Person: Billing GmbH},
|
||||||
"contactUuid": ${Contact: Billing GmbH - Test AG billing}
|
"contactUuid": ${Contact: Billing GmbH - Test AG billing}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user