fix UUID-references HsOfficeCoopAssetsTransactionControllerRestTest according to new execution path

This commit is contained in:
Michael Hoennig 2024-11-27 06:25:08 +01:00
parent 5b0c8f477c
commit bc2ec8df5c
2 changed files with 6 additions and 2 deletions

View File

@ -157,6 +157,7 @@ public class HsOfficeCoopAssetsTransactionController implements HsOfficeCoopAsse
} }
} }
// TODO.refa: this logic needs to get extracted to a service
final BiConsumer<HsOfficeCoopAssetsTransactionEntity, HsOfficeCoopAssetsTransactionResource> ENTITY_TO_RESOURCE_POSTMAPPER = (entity, resource) -> { final BiConsumer<HsOfficeCoopAssetsTransactionEntity, HsOfficeCoopAssetsTransactionResource> ENTITY_TO_RESOURCE_POSTMAPPER = (entity, resource) -> {
resource.setMembershipUuid(entity.getMembership().getUuid()); resource.setMembershipUuid(entity.getMembership().getUuid());
resource.setMembershipMemberNumber(entity.getMembership().getTaggedMemberNumber()); resource.setMembershipMemberNumber(entity.getMembership().getTaggedMemberNumber());
@ -209,6 +210,7 @@ public class HsOfficeCoopAssetsTransactionController implements HsOfficeCoopAsse
}); });
}; };
// TODO.refa: this logic needs to get extracted to a service
final BiConsumer<HsOfficeCoopAssetsTransactionInsertResource, HsOfficeCoopAssetsTransactionEntity> RESOURCE_TO_ENTITY_POSTMAPPER = (resource, entity) -> { final BiConsumer<HsOfficeCoopAssetsTransactionInsertResource, HsOfficeCoopAssetsTransactionEntity> RESOURCE_TO_ENTITY_POSTMAPPER = (resource, entity) -> {
if (resource.getMembershipUuid() != null) { if (resource.getMembershipUuid() != null) {

View File

@ -65,9 +65,11 @@ class HsOfficeCoopAssetsTransactionControllerRestTest {
.memberNumberSuffix(suffixOf(AVAILABLE_TARGET_MEMBER_NUMBER)) .memberNumberSuffix(suffixOf(AVAILABLE_TARGET_MEMBER_NUMBER))
.build(); .build();
// the following refs might change if impl changes // The following refs depend on the implementation of the respective implementation and might change if it changes.
// The same TestUuidGenerator.ref(#) does NOT mean the UUIDs refer to the same entity,
// its rather coincidence because different test-cases have different execution paths in the production code.
private static final UUID NEW_EXPLICITLY_CREATED_REVERSAL_ASSET_TX_UUID = TestUuidGenerator.ref(4); private static final UUID NEW_EXPLICITLY_CREATED_REVERSAL_ASSET_TX_UUID = TestUuidGenerator.ref(4);
private static final UUID NEW_EXPLICITLY_CREATED_TRANSFER_ASSET_TX_UUID = TestUuidGenerator.ref(5); private static final UUID NEW_EXPLICITLY_CREATED_TRANSFER_ASSET_TX_UUID = TestUuidGenerator.ref(4);
private static final UUID SOME_EXISTING_LOSS_ASSET_TX_UUID = TestUuidGenerator.use(3); private static final UUID SOME_EXISTING_LOSS_ASSET_TX_UUID = TestUuidGenerator.use(3);
public final HsOfficeCoopAssetsTransactionEntity SOME_EXISTING_LOSS_ASSET_TX_ENTITY = HsOfficeCoopAssetsTransactionEntity.builder() public final HsOfficeCoopAssetsTransactionEntity SOME_EXISTING_LOSS_ASSET_TX_ENTITY = HsOfficeCoopAssetsTransactionEntity.builder()