From 0fda68e01b5a34dae65492e6ce8a69117fadf4a5 Mon Sep 17 00:00:00 2001 From: "Marc O. Sandlus" Date: Fri, 12 Apr 2024 11:27:21 +0200 Subject: [PATCH] coop-shares-transaction-reverse-entry --- .../HsOfficeCoopSharesTransactionController.java | 6 +++--- .../hs-office/hs-office-coopshares-schemas.yaml | 2 +- ...ficeCoopSharesTransactionControllerAcceptanceTest.java | 2 +- .../HsOfficeCoopSharesTransactionEntityUnitTest.java | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionController.java b/src/main/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionController.java index f72bb4d3..e053843f 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionController.java @@ -136,9 +136,9 @@ public class HsOfficeCoopSharesTransactionController implements HsOfficeCoopShar } final BiConsumer RESOURCE_TO_ENTITY_POSTMAPPER = (resource, entity) -> { - if ( resource.getReverseEntryUuid() != null ) { - entity.setAdjustedShareTx(coopSharesTransactionRepo.findByUuid(resource.getReverseEntryUuid()) - .orElseThrow(() -> new EntityNotFoundException("ERROR: [400] reverseEntityUuid %s not found".formatted(resource.getReverseEntryUuid())))); + if ( resource.getAdjustedShareTxUuid() != null ) { + entity.setAdjustedShareTx(coopSharesTransactionRepo.findByUuid(resource.getAdjustedShareTxUuid()) + .orElseThrow(() -> new EntityNotFoundException("ERROR: [400] adjustedShareTxUuid %s not found".formatted(resource.getAdjustedShareTxUuid())))); } }; } diff --git a/src/main/resources/api-definition/hs-office/hs-office-coopshares-schemas.yaml b/src/main/resources/api-definition/hs-office/hs-office-coopshares-schemas.yaml index 4b92d77d..680321be 100644 --- a/src/main/resources/api-definition/hs-office/hs-office-coopshares-schemas.yaml +++ b/src/main/resources/api-definition/hs-office/hs-office-coopshares-schemas.yaml @@ -73,7 +73,7 @@ components: maxLength: 48 comment: type: string - reverseEntryUuid: + adjustedShareTxUuid: type: string format: uuid required: diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionControllerAcceptanceTest.java index b2681451..a84c85eb 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionControllerAcceptanceTest.java @@ -227,7 +227,7 @@ class HsOfficeCoopSharesTransactionControllerAcceptanceTest extends ContextBased "valueDate": "2022-10-30", "reference": "test ref adjustment", "comment": "some coop shares adjustment transaction", - "reverseEntryUuid": "%s" + "adjustedShareTxUuid": "%s" } """.formatted( givenMembership.getUuid(), diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionEntityUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionEntityUnitTest.java index 1d865b0a..44ade22c 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionEntityUnitTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopshares/HsOfficeCoopSharesTransactionEntityUnitTest.java @@ -51,23 +51,23 @@ class HsOfficeCoopSharesTransactionEntityUnitTest { } @Test - void toShortStringContainsOnlyMemberNumberAndShareCountOnly() { + void toShortStringContainsOnlyAbbreviatedString() { final var result = givenCoopSharesTransaction.toShortString(); - assertThat(result).isEqualTo("M-1000101+4"); + assertThat(result).isEqualTo("M-1000101:SUB:+4"); } @Test void toStringEmptyTransactionDoesNotThrowException() { final var result = givenEmptyCoopSharesTransaction.toString(); - assertThat(result).isEqualTo("CoopShareTransaction(0)"); + assertThat(result).isEqualTo("CoopShareTransaction(null: 0)"); } @Test void toShortStringEmptyTransactionDoesNotThrowException() { final var result = givenEmptyCoopSharesTransaction.toShortString(); - assertThat(result).isEqualTo("null+0"); + assertThat(result).isEqualTo("null:nul:+0"); } }