more scenario tests for coop-assets (#133)

Co-authored-by: Michael Hoennig <michael@hoennig.de>
Reviewed-on: #133
Reviewed-by: Timotheus Pokorra <timotheus.pokorra@hostsharing.net>
This commit is contained in:
Michael Hoennig 2024-12-06 10:59:02 +01:00
parent 6464d6f1ec
commit a05430a54b
5 changed files with 95 additions and 0 deletions

View File

@ -13,6 +13,7 @@ components:
- ADOPTION
- CLEARING
- LOSS
- LIMITATION
HsOfficeCoopAssetsTransaction:
type: object

View File

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

View File

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

View File

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

View File

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