add D- in front of memberNumber - ScenarioTest fixed

This commit is contained in:
Michael Hoennig 2024-11-15 17:45:30 +01:00
parent 42cafef768
commit 378d0e0c16
5 changed files with 29 additions and 24 deletions

View File

@ -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();

View File

@ -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
}

View File

@ -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);

View File

@ -9,8 +9,8 @@ import static org.springframework.http.HttpStatus.OK;
public class CreateSelfDebitorForPartner extends UseCase<CreateSelfDebitorForPartner> {
public CreateSelfDebitorForPartner(final ScenarioTest testSuite, final String resultAlias) {
super(testSuite, resultAlias);
public CreateSelfDebitorForPartner(final ScenarioTest testSuite) {
super(testSuite);
}
@Override

View File

@ -9,7 +9,7 @@ public class DeleteDebitor extends UseCase<DeleteDebitor> {
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")