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 0a844632..0f7362df 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 @@ -8,8 +8,9 @@ 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.CreateSelfDebitorForPartner; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateSepaMandateForDebitor; -import net.hostsharing.hsadminng.hs.office.scenarios.debitor.FinallyDeleteSepaMandateForDebitor; +import net.hostsharing.hsadminng.hs.office.scenarios.debitor.DeleteDebitor; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.DontDeleteDefaultDebitor; +import net.hostsharing.hsadminng.hs.office.scenarios.debitor.FinallyDeleteSepaMandateForDebitor; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.InvalidateSepaMandateForDebitor; import net.hostsharing.hsadminng.hs.office.scenarios.membership.CancelMembership; import net.hostsharing.hsadminng.hs.office.scenarios.membership.CreateMembership; @@ -20,10 +21,9 @@ import net.hostsharing.hsadminng.hs.office.scenarios.membership.coopshares.Creat import net.hostsharing.hsadminng.hs.office.scenarios.membership.coopshares.CreateCoopSharesRevertTransaction; import net.hostsharing.hsadminng.hs.office.scenarios.membership.coopshares.CreateCoopSharesSubscriptionTransaction; import net.hostsharing.hsadminng.hs.office.scenarios.partner.AddOperationsContactToPartner; -import net.hostsharing.hsadminng.hs.office.scenarios.partner.CreatePartner; -import net.hostsharing.hsadminng.hs.office.scenarios.debitor.DeleteDebitor; -import net.hostsharing.hsadminng.hs.office.scenarios.partner.DeletePartner; import net.hostsharing.hsadminng.hs.office.scenarios.partner.AddRepresentativeToPartner; +import net.hostsharing.hsadminng.hs.office.scenarios.partner.CreatePartner; +import net.hostsharing.hsadminng.hs.office.scenarios.partner.DeletePartner; import net.hostsharing.hsadminng.hs.office.scenarios.person.ShouldUpdatePersonData; import net.hostsharing.hsadminng.hs.office.scenarios.subscription.RemoveOperationsContactFromPartner; import net.hostsharing.hsadminng.hs.office.scenarios.subscription.SubscribeToMailinglist; @@ -55,7 +55,7 @@ class HsOfficeScenarioTests extends ScenarioTest { @Test @Order(1010) - @Produces(explicitly = "Partner: P-31010 - Test AG", implicitly = {"Person: Test AG", "Contact: Test AG - Hamburg"}) + @Produces(explicitly = "Partner: P-31010 - Test AG", implicitly = { "Person: Test AG", "Contact: Test AG - Hamburg" }) void shouldCreateLegalPersonAsPartner() { new CreatePartner(this) .given("partnerNumber", "P-31010") @@ -77,7 +77,8 @@ class HsOfficeScenarioTests extends ScenarioTest { @Test @Order(1011) - @Produces(explicitly = "Partner: P-31011 - Michelle Matthieu", implicitly = {"Person: Michelle Matthieu", "Contact: Michelle Matthieu"}) + @Produces(explicitly = "Partner: P-31011 - Michelle Matthieu", implicitly = { "Person: Michelle Matthieu", + "Contact: Michelle Matthieu" }) void shouldCreateNaturalPersonAsPartner() { new CreatePartner(this) .given("partnerNumber", "P-31011") @@ -191,16 +192,16 @@ class HsOfficeScenarioTests extends 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("newOfficePhoneNumber", "++15 999 654321" ) + "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(); } @@ -218,9 +219,9 @@ class HsOfficeScenarioTests extends ScenarioTest { @Test @Order(2010) @Requires("Partner: P-31010 - Test AG") - @Produces("Debitor: Test AG - main debitor") + @Produces("Debitor: D-3101000 - Test AG - main debitor") void shouldCreateSelfDebitorForPartner() { - new CreateSelfDebitorForPartner(this, "Debitor: Test AG - main debitor") + new CreateSelfDebitorForPartner(this) .given("partnerPersonTradeName", "Test AG") .given("billingContactCaption", "Test AG - billing department") .given("billingContactEmailAddress", "billing@test-ag.example.org") @@ -238,7 +239,7 @@ class HsOfficeScenarioTests extends ScenarioTest { @Test @Order(2011) @Requires("Person: Test AG") - @Produces("Debitor: D-3101000 - Test AG - main debitor") + @Produces("Debitor: D-3101001 - Test AG - main debitor") void shouldCreateExternalDebitorForPartner() { new CreateExternalDebitorForPartner(this) .given("partnerPersonTradeName", "Test AG") @@ -258,6 +259,7 @@ class HsOfficeScenarioTests extends ScenarioTest { @Test @Order(2020) @Requires("Person: Test AG") + @Produces(explicitly = "Debitor: D-3101000 - Test AG - delete debitor", permanent = false) void shouldDeleteDebitor() { new DeleteDebitor(this) .given("partnerNumber", "P-31020") @@ -378,7 +380,7 @@ class HsOfficeScenarioTests extends ScenarioTest { new CreateCoopAssetsDepositTransaction(this) .given("memberNumber", "M-3101000") .given("reference", "sign 2024-01-15") - .given("assetValue", 100*64) + .given("assetValue", 100 * 64) .given("comment", "disposal for initial shares") .given("transactionDate", "2024-01-15") .doRun(); @@ -403,7 +405,7 @@ class HsOfficeScenarioTests extends ScenarioTest { new CreateCoopAssetsDisbursalTransaction(this) .given("memberNumber", "M-3101000") .given("reference", "cancel 2024-01-15") - .given("valueToDisburse", 8*64) + .given("valueToDisburse", 8 * 64) .given("comment", "disbursal according to shares cancellation") .given("transactionDate", "2024-02-15") .doRun(); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/Produces.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/Produces.java index 07bc4e47..5d24fd2c 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/Produces.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/Produces.java @@ -12,4 +12,5 @@ public @interface Produces { String value() default ""; // same as explicitly, makes it possible to omit the property name String explicitly() default ""; // same as value String[] implicitly() default {}; + boolean permanent() default true; // false means that the object gets deleted again in the process } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/ScenarioTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/ScenarioTest.java index 530eba74..3e0dab34 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/ScenarioTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/ScenarioTest.java @@ -113,6 +113,8 @@ public abstract class ScenarioTest extends ContextBasedTest { // and it does not produce anything we already have (would cause errors) SetUtils.intersection(testMethodProduces, knowVariables().keySet()).isEmpty() ) { + assertThat(producesAnnot.permanent()).as("cannot depend on non-permanent producer: " + potentialProducerMethod); + // then we recursively produce the pre-requisites of the producer method callRequiredProducers(potentialProducerMethod); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateSelfDebitorForPartner.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateSelfDebitorForPartner.java index 1cc7a049..41b40ee6 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateSelfDebitorForPartner.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateSelfDebitorForPartner.java @@ -9,8 +9,8 @@ import static org.springframework.http.HttpStatus.OK; public class CreateSelfDebitorForPartner extends UseCase { - public CreateSelfDebitorForPartner(final ScenarioTest testSuite, final String resultAlias) { - super(testSuite, resultAlias); + public CreateSelfDebitorForPartner(final ScenarioTest testSuite) { + super(testSuite); } @Override diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/DeleteDebitor.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/DeleteDebitor.java index 19a0f159..84e9cd30 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/DeleteDebitor.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/DeleteDebitor.java @@ -9,7 +9,7 @@ public class DeleteDebitor extends UseCase { public DeleteDebitor(final ScenarioTest testSuite) { super(testSuite); - requires("Debitor: Test AG - delete debitor", alias -> new CreateSelfDebitorForPartner(testSuite, alias) + requires("Debitor: Test AG - delete debitor", alias -> new CreateSelfDebitorForPartner(testSuite) .given("partnerPersonTradeName", "Test AG") .given("billingContactCaption", "Test AG - billing department") .given("billingContactEmailAddress", "billing@test-ag.example.org")