From ee3b96ec0375259a157f1bbb2919470bbc3658f3 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 6 Dec 2024 10:16:49 +0100 Subject: [PATCH] more scenario tests for coop-assets --- .../hs-office-coopassets-schemas.yaml | 1 + .../scenarios/HsOfficeScenarioTests.java | 42 +++++++++++++++++++ .../CreateCoopAssetsClearingTransaction.java | 17 ++++++++ ...CreateCoopAssetsLimitationTransaction.java | 17 ++++++++ .../CreateCoopAssetsLossTransaction.java | 18 ++++++++ 5 files changed, 95 insertions(+) create mode 100644 src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/coopassets/CreateCoopAssetsClearingTransaction.java create mode 100644 src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/coopassets/CreateCoopAssetsLimitationTransaction.java create mode 100644 src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/coopassets/CreateCoopAssetsLossTransaction.java diff --git a/src/main/resources/api-definition/hs-office/hs-office-coopassets-schemas.yaml b/src/main/resources/api-definition/hs-office/hs-office-coopassets-schemas.yaml index 67da1790..a666229d 100644 --- a/src/main/resources/api-definition/hs-office/hs-office-coopassets-schemas.yaml +++ b/src/main/resources/api-definition/hs-office/hs-office-coopassets-schemas.yaml @@ -13,6 +13,7 @@ components: - ADOPTION - CLEARING - LOSS + - LIMITATION HsOfficeCoopAssetsTransaction: type: object 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 969019e1..9f957472 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 @@ -14,8 +14,11 @@ import net.hostsharing.hsadminng.hs.office.scenarios.debitor.FinallyDeleteSepaMa 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; +import net.hostsharing.hsadminng.hs.office.scenarios.membership.coopassets.CreateCoopAssetsClearingTransaction; import net.hostsharing.hsadminng.hs.office.scenarios.membership.coopassets.CreateCoopAssetsDepositTransaction; import net.hostsharing.hsadminng.hs.office.scenarios.membership.coopassets.CreateCoopAssetsDisbursalTransaction; +import net.hostsharing.hsadminng.hs.office.scenarios.membership.coopassets.CreateCoopAssetsLimitationTransaction; +import net.hostsharing.hsadminng.hs.office.scenarios.membership.coopassets.CreateCoopAssetsLossTransaction; import net.hostsharing.hsadminng.hs.office.scenarios.membership.coopassets.CreateCoopAssetsRevertSimpleTransaction; import net.hostsharing.hsadminng.hs.office.scenarios.membership.coopassets.CreateCoopAssetsRevertTransferTransaction; import net.hostsharing.hsadminng.hs.office.scenarios.membership.coopassets.CreateCoopAssetsTransferTransaction; @@ -510,6 +513,45 @@ class HsOfficeScenarioTests extends ScenarioTest { .given("dateOfIncorrectTransaction", "2024-02-15") .doRun(); } + + @Test + @Order(4306) + @Requires("Coop-Assets: M-3101000 - Test AG - DEPOSIT Transaction") + void shouldSettleMembersDebtWithCoopAssetsViaClearing() { + new CreateCoopAssetsClearingTransaction(scenarioTest) + .given("memberNumber", "M-3101000") + .given("reference", "cancel 2024-01-15") + .given("valueToClear", 2 * 64) + .given("comment", "clearing according to members debt") + .given("transactionDate", "2024-02-15") + .doRun(); + } + + @Test + @Order(4307) + @Requires("Coop-Assets: M-3101000 - Test AG - DEPOSIT Transaction") + void shouldAssignmentBalanceSheetLossInCaseOfCancellationOfShares() { + new CreateCoopAssetsLossTransaction(scenarioTest) + .given("memberNumber", "M-3101000") + .given("reference", "cancel 2024-01-15") + .given("valueLost", 2 * 64) + .given("comment", "assign balance sheet loss") + .given("transactionDate", "2024-02-15") + .doRun(); + } + + @Test + @Order(4307) + @Requires("Coop-Assets: M-3101000 - Test AG - DEPOSIT Transaction") + void shouldAdjustCoopAssetsAfterLimitationPeriod() { + new CreateCoopAssetsLimitationTransaction(scenarioTest) + .given("memberNumber", "M-3101000") + .given("reference", "cancel 2024-01-15") + .given("valueForLimitation", 2 * 64) + .given("comment", "adjust coop ") + .given("transactionDate", "2024-02-15") + .doRun(); + } } @Nested diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/coopassets/CreateCoopAssetsClearingTransaction.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/coopassets/CreateCoopAssetsClearingTransaction.java new file mode 100644 index 00000000..9eba0b29 --- /dev/null +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/coopassets/CreateCoopAssetsClearingTransaction.java @@ -0,0 +1,17 @@ +package net.hostsharing.hsadminng.hs.office.scenarios.membership.coopassets; + +import net.hostsharing.hsadminng.hs.scenarios.ScenarioTest; + +public class CreateCoopAssetsClearingTransaction extends CreateCoopAssetsTransaction { + + public CreateCoopAssetsClearingTransaction(final ScenarioTest testSuite) { + super(testSuite); + } + + @Override + protected HttpResponse run() { + given("transactionType", "CLEARING"); + given("assetValue", "-%{valueToClear}"); + return super.run(); + } +} diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/coopassets/CreateCoopAssetsLimitationTransaction.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/coopassets/CreateCoopAssetsLimitationTransaction.java new file mode 100644 index 00000000..3e423847 --- /dev/null +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/coopassets/CreateCoopAssetsLimitationTransaction.java @@ -0,0 +1,17 @@ +package net.hostsharing.hsadminng.hs.office.scenarios.membership.coopassets; + +import net.hostsharing.hsadminng.hs.scenarios.ScenarioTest; + +public class CreateCoopAssetsLimitationTransaction extends CreateCoopAssetsTransaction { + + public CreateCoopAssetsLimitationTransaction(final ScenarioTest testSuite) { + super(testSuite); + } + + @Override + protected HttpResponse run() { + given("transactionType", "LIMITATION"); + given("assetValue", "-%{valueForLimitation}"); + return super.run(); + } +} diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/coopassets/CreateCoopAssetsLossTransaction.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/coopassets/CreateCoopAssetsLossTransaction.java new file mode 100644 index 00000000..bcc4bc7c --- /dev/null +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/coopassets/CreateCoopAssetsLossTransaction.java @@ -0,0 +1,18 @@ +package net.hostsharing.hsadminng.hs.office.scenarios.membership.coopassets; + +import net.hostsharing.hsadminng.hs.scenarios.ScenarioTest; + +public class CreateCoopAssetsLossTransaction extends CreateCoopAssetsTransaction { + + public CreateCoopAssetsLossTransaction(final ScenarioTest testSuite) { + super(testSuite); + introduction("Usually, a loss transaction goes along with a disbursal transaction."); + } + + @Override + protected HttpResponse run() { + given("transactionType", "LOSS"); + given("assetValue", "-%{valueLost}"); + return super.run(); + } +} -- 2.39.5