diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/HsOfficeScenarioTests.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/HsOfficeScenarioTests.java index fcd7cacb..2ec80c6a 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/HsOfficeScenarioTests.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/HsOfficeScenarioTests.java @@ -132,7 +132,7 @@ class HsOfficeScenarioTests extends ScenarioTest { @Produces("Debitor: Billing GmbH") void shouldCreateExternalDebitorForPartner() { new CreateExternalDebitorForPartner(this) - .given("partnerPersonUuid", "%{Person: Test AG}") + .given("partnerPersonTradeName", "Test AG") .given("billingContactCaption", "Billing GmbH - billing department") .given("billingContactEmailAddress", "billing@test-ag.example.org") .given("debitorNumberSuffix", "01") diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/TestReport.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/TestReport.java index 6879f4b4..02123a14 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/TestReport.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/TestReport.java @@ -30,7 +30,8 @@ public class TestReport { 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(); 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 @@ -59,6 +60,10 @@ public class TestReport { markdownReport.close(); } + private static Object orderNumber(final Method method) { + return method.getAnnotation(Order.class).value(); + } + private String appendUUIDKey(String multilineText) { final var lines = multilineText.split("\\r?\\n"); final var result = new StringBuilder(); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateExternalDebitorForPartner.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateExternalDebitorForPartner.java index 92de80ce..e9afdcc2 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateExternalDebitorForPartner.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateExternalDebitorForPartner.java @@ -6,6 +6,7 @@ import net.hostsharing.hsadminng.hs.office.scenarios.person.CreatePerson; import static io.restassured.http.ContentType.JSON; import static org.springframework.http.HttpStatus.CREATED; +import static org.springframework.http.HttpStatus.OK; public class CreateExternalDebitorForPartner extends UseCase { @@ -20,6 +21,14 @@ public class CreateExternalDebitorForPartner extends UseCase + 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", () -> httpPost("/api/hs/office/bankaccounts", usingJsonBody(""" { @@ -46,7 +55,7 @@ public class CreateExternalDebitorForPartner extends UseCase