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 735d51a6..220dc0dd 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 @@ -227,16 +227,17 @@ class HsOfficeScenarioTests extends ScenarioTest { new ReplaceContactData(scenarioTest) .given("partnerName", "Test AG") .given("newContactCaption", "Test AG - China") - .given("newPostalAddress", """ - "firm": "Test AG", - "name": "Fi Zhong-Kha", - "building": "Thi Chi Koh Building", - "street": "No.2 Commercial Second Street", - "district": "Niushan Wei Wu", - "city": "Dongguan City", - "province": "Guangdong Province", - "country": "China" - """) + .given( + "newPostalAddress", """ + "firm": "Test AG", + "name": "Fi Zhong-Kha", + "building": "Thi Chi Koh Building", + "street": "No.2 Commercial Second Street", + "district": "Niushan Wei Wu", + "city": "Dongguan City", + "province": "Guangdong Province", + "country": "China" + """) .given("newOfficePhoneNumber", "++15 999 654321") .given("newEmailAddress", "norden@test-ag.example.org") .doRun(); @@ -263,6 +264,7 @@ class HsOfficeScenarioTests extends ScenarioTest { @Order(20) @TestMethodOrder(MethodOrderer.OrderAnnotation.class) class DebitorScenarios { + @Test @Order(2010) @Requires("Partner: P-31010 - Test AG") @@ -624,14 +626,12 @@ class HsOfficeScenarioTests extends ScenarioTest { .given("representativeGivenName", "Lena") .given("representativeFamilyName", "Stadland") .given( - // "name": "Erbengemeinschaft Michelle Matthieu", // FIXME: automatic? "communityOfHeirsPostalAddress", """ - "co": "Lena Stadland", // FIXME: take this form representative...? - "street": "Im Wischer 14", - "zipcode": "22987", - "city": "Hamburg", - "country": "Germany" - """) + "street": "Im Wischer 14", + "zipcode": "22987", + "city": "Hamburg", + "country": "Germany" + """) .given("communityOfHeirsOfficePhoneNumber", "+49 40 666666") .given("communityOfHeirsEmailAddress", "lena.stadland@example.org") .doRun(); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/ReplaceDeceasedPartnerWithCommunityOfHeirs.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/ReplaceDeceasedPartnerWithCommunityOfHeirs.java index 7e62d535..8d386abe 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/ReplaceDeceasedPartnerWithCommunityOfHeirs.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/ReplaceDeceasedPartnerWithCommunityOfHeirs.java @@ -48,6 +48,7 @@ public class ReplaceDeceasedPartnerWithCommunityOfHeirs extends UseCase { - // FIXME: extract to method - final var producesAnnot = currentTestMethod.getAnnotation(Produces.class); - if (producesAnnot != null && producesAnnot.permanent()) { - final var testMethodProduces = producedAliases(producesAnnot); - testMethodProduces.forEach(declaredAlias -> - assertThat(knowVariables().containsKey(declaredAlias)) - .as("@Producer method " + currentTestMethod.getName() + - " did declare but not produce \"" + declaredAlias + "\"") - .isTrue() ); - } - }); + verifyProduceDeclaration(testInfo); properties.clear(); testReport.close(); @@ -182,6 +171,20 @@ public abstract class ScenarioTest extends ContextBasedTest { } } + private static void verifyProduceDeclaration(final TestInfo testInfo) { + testInfo.getTestMethod().ifPresent(currentTestMethod -> { + final var producesAnnot = currentTestMethod.getAnnotation(Produces.class); + if (producesAnnot != null && producesAnnot.permanent()) { + final var testMethodProduces = producedAliases(producesAnnot); + testMethodProduces.forEach(declaredAlias -> + assertThat(knowVariables().containsKey(declaredAlias)) + .as("@Producer method " + currentTestMethod.getName() + + " did declare but not produce \"" + declaredAlias + "\"") + .isTrue() ); + } + }); + } + static boolean containsAlias(final String alias) { return aliases.containsKey(alias); }