From faf654e499774f5c98f1fbba738cb76ea2d40f79 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Wed, 13 Nov 2024 08:09:15 +0100 Subject: [PATCH] adjust naming in CoopAssets regarding adjustment->reversal --- ...OfficeCoopAssetsTransactionController.java | 2 +- .../HsOfficeCoopAssetsTransactionEntity.java | 16 +++++------ .../HsOfficeCoopAssetsTransactionType.java | 2 +- .../HsOfficeMembershipRepository.java | 6 ---- .../hs-office-coopassets-schemas.yaml | 8 +++--- .../5120-hs-office-coopassets.sql | 8 +++--- .../5128-hs-office-coopassets-test-data.sql | 4 +-- .../hs/migration/BaseOfficeDataImport.java | 16 +++++------ ...tsTransactionControllerAcceptanceTest.java | 28 +++++++++---------- ...opAssetsTransactionControllerRestTest.java | 2 +- ...ceCoopAssetsTransactionEntityUnitTest.java | 10 +++---- ...sTransactionRepositoryIntegrationTest.java | 20 ++++++------- .../hs/office/scenarios/UseCase.java | 9 +++++- .../migration/office/asset_transactions.csv | 2 +- 14 files changed, 67 insertions(+), 66 deletions(-) diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionController.java index b8da7580..8095c96e 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionController.java @@ -129,7 +129,7 @@ public class HsOfficeCoopAssetsTransactionController implements HsOfficeCoopAsse final BiConsumer RESOURCE_TO_ENTITY_POSTMAPPER = (resource, entity) -> { if ( resource.getReverseEntryUuid() != null ) { - entity.setAdjustedAssetTx(coopAssetsTransactionRepo.findByUuid(resource.getReverseEntryUuid()) + entity.setRevertedAssetTx(coopAssetsTransactionRepo.findByUuid(resource.getReverseEntryUuid()) .orElseThrow(() -> new EntityNotFoundException("ERROR: [400] reverseEntityUuid %s not found".formatted(resource.getReverseEntryUuid())))); } }; diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntity.java b/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntity.java index 20ef39b4..18e12a11 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntity.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntity.java @@ -50,8 +50,8 @@ public class HsOfficeCoopAssetsTransactionEntity implements Stringifyable, BaseE .withProp(HsOfficeCoopAssetsTransactionEntity::getAssetValue) .withProp(HsOfficeCoopAssetsTransactionEntity::getReference) .withProp(HsOfficeCoopAssetsTransactionEntity::getComment) - .withProp(at -> ofNullable(at.getAdjustedAssetTx()).map(HsOfficeCoopAssetsTransactionEntity::toShortString).orElse(null)) - .withProp(at -> ofNullable(at.getAdjustmentAssetTx()).map(HsOfficeCoopAssetsTransactionEntity::toShortString).orElse(null)) + .withProp(at -> ofNullable(at.getRevertedAssetTx()).map(HsOfficeCoopAssetsTransactionEntity::toShortString).orElse(null)) + .withProp(at -> ofNullable(at.getReversalAssetTx()).map(HsOfficeCoopAssetsTransactionEntity::toShortString).orElse(null)) .quotedValues(false); @Id @@ -77,7 +77,7 @@ public class HsOfficeCoopAssetsTransactionEntity implements Stringifyable, BaseE * The signed value which directly affects the booking balance. * *

This means, that a DEPOSIT is always positive, a DISBURSAL is always negative, - * but an ADJUSTMENT can bei either positive or negative. + * but an REVERSAL can bei either positive or negative. * See {@link HsOfficeCoopAssetsTransactionType} for

more information. */ @Column(name = "assetvalue") @@ -96,14 +96,14 @@ public class HsOfficeCoopAssetsTransactionEntity implements Stringifyable, BaseE private String comment; /** - * Optionally, the UUID of the corresponding transaction for an adjustment transaction. + * Optionally, the UUID of the corresponding transaction for an reversal transaction. */ @OneToOne - @JoinColumn(name = "adjustedassettxuuid") - private HsOfficeCoopAssetsTransactionEntity adjustedAssetTx; + @JoinColumn(name = "revertedassettxuuid") + private HsOfficeCoopAssetsTransactionEntity revertedAssetTx; - @OneToOne(mappedBy = "adjustedAssetTx") - private HsOfficeCoopAssetsTransactionEntity adjustmentAssetTx; + @OneToOne(mappedBy = "revertedAssetTx") + private HsOfficeCoopAssetsTransactionEntity reversalAssetTx; @Override public HsOfficeCoopAssetsTransactionEntity load() { diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionType.java b/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionType.java index d7397622..ee53bec4 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionType.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionType.java @@ -4,7 +4,7 @@ public enum HsOfficeCoopAssetsTransactionType { /** * correction of wrong bookings, value can be positive or negative */ - ADJUSTMENT, + REVERSAL, /** * payment received from member after signing shares, value >0 diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipRepository.java b/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipRepository.java index 282bfaf6..d7f36d07 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipRepository.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/membership/HsOfficeMembershipRepository.java @@ -38,12 +38,6 @@ public interface HsOfficeMembershipRepository extends Repository 'ADJUSTMENT' and adjustedAssetTxUuid is null); + check ( transactionType = 'REVERSAL' and revertedAssetTxUuid is not null + or transactionType <> 'REVERSAL' and revertedAssetTxUuid is null); --// -- ============================================================================ diff --git a/src/main/resources/db/changelog/5-hs-office/512-coopassets/5128-hs-office-coopassets-test-data.sql b/src/main/resources/db/changelog/5-hs-office/512-coopassets/5128-hs-office-coopassets-test-data.sql index ed824b12..ac43a731 100644 --- a/src/main/resources/db/changelog/5-hs-office/512-coopassets/5128-hs-office-coopassets-test-data.sql +++ b/src/main/resources/db/changelog/5-hs-office/512-coopassets/5128-hs-office-coopassets-test-data.sql @@ -27,12 +27,12 @@ begin raise notice 'creating test coopAssetsTransaction: %', givenPartnerNumber || givenMemberNumberSuffix; lossEntryUuid := uuid_generate_v4(); insert - into hs_office.coopassettx(uuid, membershipuuid, transactiontype, valuedate, assetvalue, reference, comment, adjustedAssetTxUuid) + into hs_office.coopassettx(uuid, membershipuuid, transactiontype, valuedate, assetvalue, reference, comment, revertedAssetTxUuid) values (uuid_generate_v4(), membership.uuid, 'DEPOSIT', '2010-03-15', 320.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-1', 'initial deposit', null), (uuid_generate_v4(), membership.uuid, 'DISBURSAL', '2021-09-01', -128.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-2', 'partial disbursal', null), (lossEntryUuid, membership.uuid, 'DEPOSIT', '2022-10-20', 128.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-3', 'some loss', null), - (uuid_generate_v4(), membership.uuid, 'ADJUSTMENT', '2022-10-21', -128.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-3', 'some adjustment', lossEntryUuid); + (uuid_generate_v4(), membership.uuid, 'REVERSAL', '2022-10-21', -128.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-3', 'some reversal', lossEntryUuid); end; $$; --// diff --git a/src/test/java/net/hostsharing/hsadminng/hs/migration/BaseOfficeDataImport.java b/src/test/java/net/hostsharing/hsadminng/hs/migration/BaseOfficeDataImport.java index 626e4613..2c8dfe82 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/migration/BaseOfficeDataImport.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/migration/BaseOfficeDataImport.java @@ -442,7 +442,7 @@ public abstract class BaseOfficeDataImport extends CsvDataImport { 34002=CoopAssetsTransaction(M-1002000: 2016-12-31, DISBURSAL, -100.00, 1002000, for cancellation D), 34003=CoopAssetsTransaction(M-1002000: 2016-12-31, LOSS, -20.00, 1002000, for cancellation D), 35001=CoopAssetsTransaction(M-1909000: 2024-01-15, DEPOSIT, 128.00, 1909000, for subscription E), - 35002=CoopAssetsTransaction(M-1909000: 2024-01-20, ADJUSTMENT, -128.00, 1909000, chargeback for subscription E, M-1909000:DEP:+128.00), + 35002=CoopAssetsTransaction(M-1909000: 2024-01-20, REVERSAL, -128.00, 1909000, chargeback for subscription E, M-1909000:DEP:+128.00), 358=CoopAssetsTransaction(M-1000300: 2000-12-06, DEPOSIT, 5120, 1000300, for subscription A), 442=CoopAssetsTransaction(M-1015200: 2003-07-07, DEPOSIT, 64, 1015200), 577=CoopAssetsTransaction(M-1000300: 2011-12-12, DEPOSIT, 1024, 1000300), @@ -810,7 +810,7 @@ public abstract class BaseOfficeDataImport extends CsvDataImport { a.getShareCount() == negativeValue) .findAny() .orElseThrow(() -> new IllegalStateException( - "cannot determine share reverse entry for adjustment " + shareTransaction)); + "cannot determine share reverse entry for reversal " + shareTransaction)); shareTransaction.setRevertedShareTx(revertedShareTx); } coopShares.put(rec.getInteger("member_share_id"), shareTransaction); @@ -837,7 +837,7 @@ public abstract class BaseOfficeDataImport extends CsvDataImport { final var assetTypeMapping = new HashMap() { { - put("ADJUSTMENT", HsOfficeCoopAssetsTransactionType.ADJUSTMENT); + put("REVERSAL", HsOfficeCoopAssetsTransactionType.REVERSAL); put("HANDOVER", HsOfficeCoopAssetsTransactionType.TRANSFER); put("ADOPTION", HsOfficeCoopAssetsTransactionType.ADOPTION); put("LOSS", HsOfficeCoopAssetsTransactionType.LOSS); @@ -865,16 +865,16 @@ public abstract class BaseOfficeDataImport extends CsvDataImport { .reference(member.getMemberNumber().toString()) .build(); - if (assetTransaction.getTransactionType() == HsOfficeCoopAssetsTransactionType.ADJUSTMENT) { + if (assetTransaction.getTransactionType() == HsOfficeCoopAssetsTransactionType.REVERSAL) { final var negativeValue = assetTransaction.getAssetValue().negate(); - final var adjustedAssetTx = coopAssets.values().stream().filter(a -> - a.getTransactionType() != HsOfficeCoopAssetsTransactionType.ADJUSTMENT && + final var revertedAssetTx = coopAssets.values().stream().filter(a -> + a.getTransactionType() != HsOfficeCoopAssetsTransactionType.REVERSAL && a.getMembership() == assetTransaction.getMembership() && a.getAssetValue().equals(negativeValue)) .findAny() .orElseThrow(() -> new IllegalStateException( - "cannot determine asset reverse entry for adjustment " + assetTransaction)); - assetTransaction.setAdjustedAssetTx(adjustedAssetTx); + "cannot determine asset reverse entry for reversal " + assetTransaction)); + assetTransaction.setRevertedAssetTx(revertedAssetTx); } coopAssets.put(rec.getInteger("member_asset_id"), assetTransaction); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerAcceptanceTest.java index 6ac97292..53067d45 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerAcceptanceTest.java @@ -109,21 +109,21 @@ class HsOfficeCoopAssetsTransactionControllerAcceptanceTest extends ContextBased "valueDate": "2022-10-20", "reference": "ref 1000202-3", "comment": "some loss", - "adjustmentAssetTx": { - "transactionType": "ADJUSTMENT", + "reversalAssetTx": { + "transactionType": "REVERSAL", "assetValue": -128.00, "valueDate": "2022-10-21", "reference": "ref 1000202-3", - "comment": "some adjustment" + "comment": "some reversal" } }, { - "transactionType": "ADJUSTMENT", + "transactionType": "REVERSAL", "assetValue": -128.00, "valueDate": "2022-10-21", "reference": "ref 1000202-3", - "comment": "some adjustment", - "adjustedAssetTx": { + "comment": "some reversal", + "revertedAssetTx": { "transactionType": "DEPOSIT", "assetValue": 128.00, "valueDate": "2022-10-20", @@ -214,7 +214,7 @@ class HsOfficeCoopAssetsTransactionControllerAcceptanceTest extends ContextBased } @Test - void globalAdmin_canAddCoopAssetsAdjustmentTransaction() { + void globalAdmin_canAddCoopAssetsReversalTransaction() { context.define("superuser-alex@hostsharing.net"); final var givenMembership = membershipRepo.findMembershipByMemberNumber(1000101); @@ -238,11 +238,11 @@ class HsOfficeCoopAssetsTransactionControllerAcceptanceTest extends ContextBased .body(""" { "membership.uuid": "%s", - "transactionType": "ADJUSTMENT", + "transactionType": "REVERSAL", "assetValue": %s, "valueDate": "2022-10-30", - "reference": "test ref adjustment", - "comment": "some coop assets adjustment transaction", + "reference": "test ref reversal", + "comment": "some coop assets reversal transaction", "reverseEntry.uuid": "%s" } """.formatted( @@ -258,12 +258,12 @@ class HsOfficeCoopAssetsTransactionControllerAcceptanceTest extends ContextBased .body("uuid", isUuidValid()) .body("", lenientlyEquals(""" { - "transactionType": "ADJUSTMENT", + "transactionType": "REVERSAL", "assetValue": -256.00, "valueDate": "2022-10-30", - "reference": "test ref adjustment", - "comment": "some coop assets adjustment transaction", - "adjustedAssetTx": { + "reference": "test ref reversal", + "comment": "some coop assets reversal transaction", + "revertedAssetTx": { "transactionType": "DEPOSIT", "assetValue": 256.00, "valueDate": "2022-10-20", diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java index b7f44b35..46779410 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionControllerRestTest.java @@ -77,7 +77,7 @@ class HsOfficeCoopAssetsTransactionControllerRestTest { ASSETS_VALUE_MUST_NOT_BE_NULL( requestBody -> requestBody - .with("transactionType", "ADJUSTMENT") + .with("transactionType", "REVERSAL") .with("assetValue", 0.00), "[assetValue must not be 0 but is \"0.00\"]"), diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntityUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntityUnitTest.java index 09f704d6..0e6606c2 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntityUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionEntityUnitTest.java @@ -21,14 +21,14 @@ class HsOfficeCoopAssetsTransactionEntityUnitTest { .build(); - final HsOfficeCoopAssetsTransactionEntity givenCoopAssetAdjustmentTransaction = HsOfficeCoopAssetsTransactionEntity.builder() + final HsOfficeCoopAssetsTransactionEntity givenCoopAssetReversalTransaction = HsOfficeCoopAssetsTransactionEntity.builder() .membership(TEST_MEMBERSHIP) .reference("some-ref") .valueDate(LocalDate.parse("2020-01-15")) - .transactionType(HsOfficeCoopAssetsTransactionType.ADJUSTMENT) + .transactionType(HsOfficeCoopAssetsTransactionType.REVERSAL) .assetValue(new BigDecimal("-128.00")) .comment("some comment") - .adjustedAssetTx(givenCoopAssetTransaction) + .revertedAssetTx(givenCoopAssetTransaction) .build(); final HsOfficeCoopAssetsTransactionEntity givenEmptyCoopAssetsTransaction = HsOfficeCoopAssetsTransactionEntity.builder().build(); @@ -42,11 +42,11 @@ class HsOfficeCoopAssetsTransactionEntityUnitTest { @Test void toStringWithReverseEntryContainsReverseEntry() { - givenCoopAssetTransaction.setAdjustedAssetTx(givenCoopAssetAdjustmentTransaction); + givenCoopAssetTransaction.setRevertedAssetTx(givenCoopAssetReversalTransaction); final var result = givenCoopAssetTransaction.toString(); - assertThat(result).isEqualTo("CoopAssetsTransaction(M-1000101: 2020-01-01, DEPOSIT, 128.00, some-ref, some comment, M-1000101:ADJ:-128.00)"); + assertThat(result).isEqualTo("CoopAssetsTransaction(M-1000101: 2020-01-01, DEPOSIT, 128.00, some-ref, some comment, M-1000101:REV:-128.00)"); } @Test diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionRepositoryIntegrationTest.java index 8f650fa9..5d9316e2 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionRepositoryIntegrationTest.java @@ -142,18 +142,18 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase result, "CoopAssetsTransaction(M-1000101: 2010-03-15, DEPOSIT, 320.00, ref 1000101-1, initial deposit)", "CoopAssetsTransaction(M-1000101: 2021-09-01, DISBURSAL, -128.00, ref 1000101-2, partial disbursal)", - "CoopAssetsTransaction(M-1000101: 2022-10-20, DEPOSIT, 128.00, ref 1000101-3, some loss, M-1000101:ADJ:-128.00)", - "CoopAssetsTransaction(M-1000101: 2022-10-21, ADJUSTMENT, -128.00, ref 1000101-3, some adjustment, M-1000101:DEP:+128.00)", + "CoopAssetsTransaction(M-1000101: 2022-10-20, DEPOSIT, 128.00, ref 1000101-3, some loss, M-1000101:REV:-128.00)", + "CoopAssetsTransaction(M-1000101: 2022-10-21, REVERSAL, -128.00, ref 1000101-3, some reversal, M-1000101:DEP:+128.00)", "CoopAssetsTransaction(M-1000202: 2010-03-15, DEPOSIT, 320.00, ref 1000202-1, initial deposit)", "CoopAssetsTransaction(M-1000202: 2021-09-01, DISBURSAL, -128.00, ref 1000202-2, partial disbursal)", - "CoopAssetsTransaction(M-1000202: 2022-10-20, DEPOSIT, 128.00, ref 1000202-3, some loss, M-1000202:ADJ:-128.00)", - "CoopAssetsTransaction(M-1000202: 2022-10-21, ADJUSTMENT, -128.00, ref 1000202-3, some adjustment, M-1000202:DEP:+128.00)", + "CoopAssetsTransaction(M-1000202: 2022-10-20, DEPOSIT, 128.00, ref 1000202-3, some loss, M-1000202:REV:-128.00)", + "CoopAssetsTransaction(M-1000202: 2022-10-21, REVERSAL, -128.00, ref 1000202-3, some reversal, M-1000202:DEP:+128.00)", "CoopAssetsTransaction(M-1000303: 2010-03-15, DEPOSIT, 320.00, ref 1000303-1, initial deposit)", "CoopAssetsTransaction(M-1000303: 2021-09-01, DISBURSAL, -128.00, ref 1000303-2, partial disbursal)", - "CoopAssetsTransaction(M-1000303: 2022-10-20, DEPOSIT, 128.00, ref 1000303-3, some loss, M-1000303:ADJ:-128.00)", - "CoopAssetsTransaction(M-1000303: 2022-10-21, ADJUSTMENT, -128.00, ref 1000303-3, some adjustment, M-1000303:DEP:+128.00)"); + "CoopAssetsTransaction(M-1000303: 2022-10-20, DEPOSIT, 128.00, ref 1000303-3, some loss, M-1000303:REV:-128.00)", + "CoopAssetsTransaction(M-1000303: 2022-10-21, REVERSAL, -128.00, ref 1000303-3, some reversal, M-1000303:DEP:+128.00)"); } @Test @@ -173,8 +173,8 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase result, "CoopAssetsTransaction(M-1000202: 2010-03-15, DEPOSIT, 320.00, ref 1000202-1, initial deposit)", "CoopAssetsTransaction(M-1000202: 2021-09-01, DISBURSAL, -128.00, ref 1000202-2, partial disbursal)", - "CoopAssetsTransaction(M-1000202: 2022-10-20, DEPOSIT, 128.00, ref 1000202-3, some loss, M-1000202:ADJ:-128.00)", - "CoopAssetsTransaction(M-1000202: 2022-10-21, ADJUSTMENT, -128.00, ref 1000202-3, some adjustment, M-1000202:DEP:+128.00)"); + "CoopAssetsTransaction(M-1000202: 2022-10-20, DEPOSIT, 128.00, ref 1000202-3, some loss, M-1000202:REV:-128.00)", + "CoopAssetsTransaction(M-1000202: 2022-10-21, REVERSAL, -128.00, ref 1000202-3, some reversal, M-1000202:DEP:+128.00)"); } @Test @@ -211,8 +211,8 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase result, "CoopAssetsTransaction(M-1000101: 2010-03-15, DEPOSIT, 320.00, ref 1000101-1, initial deposit)", "CoopAssetsTransaction(M-1000101: 2021-09-01, DISBURSAL, -128.00, ref 1000101-2, partial disbursal)", - "CoopAssetsTransaction(M-1000101: 2022-10-20, DEPOSIT, 128.00, ref 1000101-3, some loss, M-1000101:ADJ:-128.00)", - "CoopAssetsTransaction(M-1000101: 2022-10-21, ADJUSTMENT, -128.00, ref 1000101-3, some adjustment, M-1000101:DEP:+128.00)"); + "CoopAssetsTransaction(M-1000101: 2022-10-20, DEPOSIT, 128.00, ref 1000101-3, some loss, M-1000101:REV:-128.00)", + "CoopAssetsTransaction(M-1000101: 2022-10-21, REVERSAL, -128.00, ref 1000101-3, some reversal, M-1000101:DEP:+128.00)"); } } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/UseCase.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/UseCase.java index 2111349c..62addd5f 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/UseCase.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/UseCase.java @@ -279,7 +279,7 @@ public abstract class UseCase> { public HttpResponse keepAs(final String alias) { ScenarioTest.putAlias( - alias == null ? "unknown alias" : alias, // FIXME + nonNullAlias(alias), new ScenarioTest.Alias<>(UseCase.this.getClass(), locationUuid)); return this; } @@ -348,6 +348,13 @@ public abstract class UseCase> { testReport.printLine("```"); testReport.printLine(""); } + + private String nonNullAlias(final String alias) { + // This marker tag should not appear in the source-code, as here is nothing to fix. + // But if it appears in generated Markdown files, it should show up when that marker tag is searched. + final var onlyVisibleInGeneratedMarkdownNotInSource = new String(new char[]{'F', 'I', 'X', 'M', 'E'}); + return alias == null ? "unknown alias -- " + onlyVisibleInGeneratedMarkdownNotInSource : alias; + } } protected T self() { diff --git a/src/test/resources/migration/office/asset_transactions.csv b/src/test/resources/migration/office/asset_transactions.csv index a0a83e02..d4f69478 100644 --- a/src/test/resources/migration/office/asset_transactions.csv +++ b/src/test/resources/migration/office/asset_transactions.csv @@ -16,4 +16,4 @@ member_asset_id; bp_id; date; action; amount; comment 34002; 120; 2016-12-31; PAYBACK; -100.00; for cancellation D 34003; 120; 2016-12-31; LOSS; -20.00; for cancellation D 35001; 190; 2024-01-15; PAYMENT; 128.00; for subscription E -35002; 190; 2024-01-20; ADJUSTMENT;-128.00; chargeback for subscription E +35002; 190; 2024-01-20; REVERSAL;-128.00; chargeback for subscription E