add coop-shares-tests

This commit is contained in:
Michael Hoennig 2024-11-12 20:01:04 +01:00
parent 6177e32051
commit cbf68f8657
13 changed files with 153 additions and 63 deletions

View File

@ -57,7 +57,7 @@ public class HsOfficeCoopSharesTransactionController implements HsOfficeCoopShar
@Override @Override
@Transactional @Transactional
public ResponseEntity<HsOfficeCoopSharesTransactionResource> addCoopSharesTransaction( public ResponseEntity<HsOfficeCoopSharesTransactionResource> postCoopSharesTransaction(
final String currentSubject, final String currentSubject,
final String assumedRoles, final String assumedRoles,
final HsOfficeCoopSharesTransactionInsertResource requestBody) { final HsOfficeCoopSharesTransactionInsertResource requestBody) {
@ -131,9 +131,9 @@ public class HsOfficeCoopSharesTransactionController implements HsOfficeCoopShar
} }
final BiConsumer<HsOfficeCoopSharesTransactionInsertResource, HsOfficeCoopSharesTransactionEntity> RESOURCE_TO_ENTITY_POSTMAPPER = (resource, entity) -> { final BiConsumer<HsOfficeCoopSharesTransactionInsertResource, HsOfficeCoopSharesTransactionEntity> RESOURCE_TO_ENTITY_POSTMAPPER = (resource, entity) -> {
if ( resource.getAdjustedShareTxUuid() != null ) { if ( resource.getRevertedShareTxUuid() != null ) {
entity.setAdjustedShareTx(coopSharesTransactionRepo.findByUuid(resource.getAdjustedShareTxUuid()) entity.setAdjustedShareTx(coopSharesTransactionRepo.findByUuid(resource.getRevertedShareTxUuid())
.orElseThrow(() -> new EntityNotFoundException("ERROR: [400] adjustedShareTxUuid %s not found".formatted(resource.getAdjustedShareTxUuid())))); .orElseThrow(() -> new EntityNotFoundException("ERROR: [400] adjustedShareTxUuid %s not found".formatted(resource.getRevertedShareTxUuid()))));
} }
}; };
} }

View File

@ -14,6 +14,7 @@ public interface HsOfficeMembershipRepository extends Repository<HsOfficeMembers
HsOfficeMembershipEntity save(final HsOfficeMembershipEntity entity); HsOfficeMembershipEntity save(final HsOfficeMembershipEntity entity);
List<HsOfficeMembershipEntity> findAll();
@Query(""" @Query("""
SELECT membership FROM HsOfficeMembershipEntity membership SELECT membership FROM HsOfficeMembershipEntity membership
@ -22,6 +23,7 @@ public interface HsOfficeMembershipRepository extends Repository<HsOfficeMembers
ORDER BY membership.partner.partnerNumber, membership.memberNumberSuffix ORDER BY membership.partner.partnerNumber, membership.memberNumberSuffix
""") """)
List<HsOfficeMembershipEntity> findMembershipsByOptionalPartnerUuid(UUID partnerUuid); List<HsOfficeMembershipEntity> findMembershipsByOptionalPartnerUuid(UUID partnerUuid);
@Query(""" @Query("""
SELECT membership FROM HsOfficeMembershipEntity membership SELECT membership FROM HsOfficeMembershipEntity membership
WHERE (:partnerNumber = membership.partner.partnerNumber) WHERE (:partnerNumber = membership.partner.partnerNumber)
@ -31,10 +33,18 @@ public interface HsOfficeMembershipRepository extends Repository<HsOfficeMembers
HsOfficeMembershipEntity findMembershipByPartnerNumberAndSuffix( HsOfficeMembershipEntity findMembershipByPartnerNumberAndSuffix(
@NotNull Integer partnerNumber, @NotNull Integer partnerNumber,
@NotNull String suffix); @NotNull String suffix);
default HsOfficeMembershipEntity findMembershipByMemberNumber(Integer memberNumber) { default HsOfficeMembershipEntity findMembershipByMemberNumber(Integer memberNumber) {
final var partnerNumber = memberNumber / 100; final var partnerNumber = memberNumber / 100;
final var suffix = memberNumber % 100; final String suffix = String.format("%02d", memberNumber % 100);
return findMembershipByPartnerNumberAndSuffix(partnerNumber, String.format("%02d", suffix)); final var result = findMembershipByPartnerNumberAndSuffix(partnerNumber, suffix);
// FIXME: remove
if (result == null) {
final var all = findAll();
all.size();
}
return result;
} }
long count(); long count();

View File

@ -6,7 +6,7 @@ components:
HsOfficeCoopAssetsTransactionType: HsOfficeCoopAssetsTransactionType:
type: string type: string
enum: enum:
- ADJUSTMENT - ADJUSTMENT # FIXME: rename to REVERSAL
- DEPOSIT - DEPOSIT
- DISBURSAL - DISBURSAL
- TRANSFER - TRANSFER
@ -32,9 +32,9 @@ components:
type: string type: string
comment: comment:
type: string type: string
adjustedAssetTx: adjustedAssetTx: # FIXME: rename to revertedAssetTx
$ref: '#/components/schemas/HsOfficeReferencedCoopAssetsTransaction' $ref: '#/components/schemas/HsOfficeReferencedCoopAssetsTransaction'
adjustmentAssetTx: adjustmentAssetTx: # FIXME: rename to reversalAssetTx
$ref: '#/components/schemas/HsOfficeReferencedCoopAssetsTransaction' $ref: '#/components/schemas/HsOfficeReferencedCoopAssetsTransaction'
HsOfficeReferencedCoopAssetsTransaction: HsOfficeReferencedCoopAssetsTransaction:
@ -80,7 +80,7 @@ components:
maxLength: 48 maxLength: 48
comment: comment:
type: string type: string
reverseEntry.uuid: reverseEntry.uuid: # FIXME: rename to revertedAssetTx
type: string type: string
format: uuid format: uuid
required: required:

View File

@ -6,7 +6,7 @@ components:
HsOfficeCoopSharesTransactionType: HsOfficeCoopSharesTransactionType:
type: string type: string
enum: enum:
- ADJUSTMENT - ADJUSTMENT # FIXME: rename to REVERSAL
- SUBSCRIPTION - SUBSCRIPTION
- CANCELLATION - CANCELLATION
@ -27,9 +27,9 @@ components:
type: string type: string
comment: comment:
type: string type: string
adjustedShareTx: revertedShareTx:
$ref: '#/components/schemas/HsOfficeReferencedCoopSharesTransaction' $ref: '#/components/schemas/HsOfficeReferencedCoopSharesTransaction'
adjustmentShareTx: reversalShareTx:
$ref: '#/components/schemas/HsOfficeReferencedCoopSharesTransaction' $ref: '#/components/schemas/HsOfficeReferencedCoopSharesTransaction'
HsOfficeReferencedCoopSharesTransaction: HsOfficeReferencedCoopSharesTransaction:
@ -73,7 +73,7 @@ components:
maxLength: 48 maxLength: 48
comment: comment:
type: string type: string
adjustedShareTx.uuid: revertedShareTx.uuid:
type: string type: string
format: uuid format: uuid
required: required:

View File

@ -46,7 +46,7 @@ post:
summary: Adds a new cooperative share transaction. summary: Adds a new cooperative share transaction.
tags: tags:
- hs-office-coopShares - hs-office-coopShares
operationId: addCoopSharesTransaction operationId: postCoopSharesTransaction
parameters: parameters:
- $ref: 'auth.yaml#/components/parameters/currentSubject' - $ref: 'auth.yaml#/components/parameters/currentSubject'
- $ref: 'auth.yaml#/components/parameters/assumedRoles' - $ref: 'auth.yaml#/components/parameters/assumedRoles'

View File

@ -28,6 +28,9 @@ create table if not exists hs_office.relation
); );
--// --//
-- TODO.impl: unique constraint, to prevent using the same person multiple times as a partner, or better:
-- ( anchorUuid, holderUuid, type)
-- ============================================================================ -- ============================================================================
--changeset michael.hoennig:hs-office-relation-MAIN-TABLE-JOURNAL endDelimiter:--// --changeset michael.hoennig:hs-office-relation-MAIN-TABLE-JOURNAL endDelimiter:--//

View File

@ -12,7 +12,9 @@ import net.hostsharing.hsadminng.hs.office.scenarios.debitor.FinallyDeleteSepaMa
import net.hostsharing.hsadminng.hs.office.scenarios.debitor.DontDeleteDefaultDebitor; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.DontDeleteDefaultDebitor;
import net.hostsharing.hsadminng.hs.office.scenarios.debitor.InvalidateSepaMandateForDebitor; 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.CancelMembership;
import net.hostsharing.hsadminng.hs.office.scenarios.membership.CoopSharesTransactionUseCase; import net.hostsharing.hsadminng.hs.office.scenarios.membership.CreateCoopSharesCancellationTransaction;
import net.hostsharing.hsadminng.hs.office.scenarios.membership.CreateCoopSharesRevertTransaction;
import net.hostsharing.hsadminng.hs.office.scenarios.membership.CreateCoopSharesSubscriptionTransaction;
import net.hostsharing.hsadminng.hs.office.scenarios.membership.CreateMembership; import net.hostsharing.hsadminng.hs.office.scenarios.membership.CreateMembership;
import net.hostsharing.hsadminng.hs.office.scenarios.partner.AddOperationsContactToPartner; import net.hostsharing.hsadminng.hs.office.scenarios.partner.AddOperationsContactToPartner;
import net.hostsharing.hsadminng.hs.office.scenarios.partner.CreatePartner; import net.hostsharing.hsadminng.hs.office.scenarios.partner.CreatePartner;
@ -262,18 +264,18 @@ class HsOfficeScenarioTests extends ScenarioTest {
@Test @Test
@Order(2020) @Order(2020)
@Requires("Debitor: Test AG - main debitor") @Requires("Debitor: D-3101000 - Test AG - main debitor")
@Disabled("see TODO.spec in DontDeleteDefaultDebitor") @Disabled("see TODO.spec in DontDeleteDefaultDebitor")
void shouldNotDeleteDefaultDebitor() { void shouldNotDeleteDefaultDebitor() {
new DontDeleteDefaultDebitor(this) new DontDeleteDefaultDebitor(this)
.given("partnerNumber", 31020) .given("partnerNumber", 31010)
.given("debitorSuffix", "00") .given("debitorSuffix", "00")
.doRun(); .doRun();
} }
@Test @Test
@Order(3100) @Order(3100)
@Requires("Debitor: Test AG - main debitor") @Requires("Debitor: D-3101000 - Test AG - main debitor")
@Produces("SEPA-Mandate: Test AG") @Produces("SEPA-Mandate: Test AG")
void shouldCreateSepaMandateForDebitor() { void shouldCreateSepaMandateForDebitor() {
new CreateSepaMandateForDebitor(this) new CreateSepaMandateForDebitor(this)
@ -328,15 +330,14 @@ class HsOfficeScenarioTests extends ScenarioTest {
} }
@Test @Test
@Order(4200) @Order(4201)
@Requires("Membership: M-3101000 - Test AG") @Requires("Membership: M-3101000 - Test AG")
@Produces("Coop-Shares SUBSCRIPTION Transaction") @Produces("Coop-Shares SUBSCRIPTION Transaction")
void testCoopSharesSubscriptionTransaction() { void shouldSubscribeCoopShares() {
new CoopSharesTransactionUseCase(this) new CreateCoopSharesSubscriptionTransaction(this)
.given("memberNumber", "3101000") .given("memberNumber", "3101000")
.given("transactionType", "SUBSCRIPTION")
.given("reference", "sign 2024-01-15") .given("reference", "sign 2024-01-15")
.given("shareCount", "100") .given("shareCount", 100)
.given("comment", "Signing the Membership") .given("comment", "Signing the Membership")
.given("transactionDate", "2024-01-15") .given("transactionDate", "2024-01-15")
.doRun(); .doRun();
@ -344,16 +345,12 @@ class HsOfficeScenarioTests extends ScenarioTest {
@Test @Test
@Order(4201) @Order(4201)
@Requires("Coop-Shares SUBSCRIPTION Transaction") @Requires("Membership: M-3101000 - Test AG")
@Produces("Coop-Shares ADJUSTMENT Transaction") void shouldRevertCoopSharesSubscription() {
void testCoopSharesAdjustmentTransaction() { new CreateCoopSharesRevertTransaction(this)
new CoopSharesTransactionUseCase(this) .given("memberNumber", "3101000")
.given("memberNumber", "3102000") .given("comment", "reverting some incorrect subscription")
.given("transactionType", "ADJUSTMENT") .given("dateOfIncorrectTransaction", "2024-02-15")
.given("reference", "adjust 2024-01-16")
.given("shareCount", "-90")
.given("comment", "Cancelling 90 Shares, correcting wrong number of digits in subscription")
.given("transactionDate", "2024-01-16")
.doRun(); .doRun();
} }
@ -361,12 +358,11 @@ class HsOfficeScenarioTests extends ScenarioTest {
@Order(4202) @Order(4202)
@Requires("Coop-Shares SUBSCRIPTION Transaction") @Requires("Coop-Shares SUBSCRIPTION Transaction")
@Produces("Coop-Shares CANCELLATION Transaction") @Produces("Coop-Shares CANCELLATION Transaction")
void testCoopSharesCancellationTransaction() { void shouldCancelCoopSharesSubscription() {
new CoopSharesTransactionUseCase(this) new CreateCoopSharesCancellationTransaction(this)
.given("memberNumber", "3102000") .given("memberNumber", "3101000")
.given("transactionType", "CANCELLATION")
.given("reference", "cancel 2024-01-15") .given("reference", "cancel 2024-01-15")
.given("shareCount", "8") .given("sharesToCancel", 8)
.given("comment", "Cancelling 8 Shares") .given("comment", "Cancelling 8 Shares")
.given("transactionDate", "2024-02-15") .given("transactionDate", "2024-02-15")
.doRun(); .doRun();

View File

@ -1,6 +1,7 @@
package net.hostsharing.hsadminng.hs.office.scenarios; package net.hostsharing.hsadminng.hs.office.scenarios;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.TestInfo; import org.junit.jupiter.api.TestInfo;
@ -15,23 +16,27 @@ import static org.assertj.core.api.Assertions.assertThat;
public class TestReport { public class TestReport {
private final Map<String, ?> aliases; private final static File markdownLogFile = new File("doc/scenarios/last-debug-log.md");
private final StringBuilder markdownLog = new StringBuilder(); // records everything for debugging purposes
private PrintWriter markdownReport; private final Map<String, ?> aliases;
private final PrintWriter markdownLog; // records everything for debugging purposes
private File markdownReportFile;
private PrintWriter markdownReport; // records only the use-case under test, without its pre-requisites
private int silent; // do not print anything to test-report if >0 private int silent; // do not print anything to test-report if >0
@SneakyThrows
public TestReport(final Map<String, ?> aliases) { public TestReport(final Map<String, ?> aliases) {
this.aliases = aliases; this.aliases = aliases;
this.markdownLog = new PrintWriter(new FileWriter(markdownLogFile));
} }
public void createTestLogMarkdownFile(final TestInfo testInfo) throws IOException { public void createTestLogMarkdownFile(final TestInfo testInfo) throws IOException {
final var testMethodName = testInfo.getTestMethod().map(Method::getName).orElseThrow(); final var testMethodName = testInfo.getTestMethod().map(Method::getName).orElseThrow();
final var testMethodOrder = testInfo.getTestMethod().map(m -> m.getAnnotation(Order.class).value()).orElseThrow(); final var testMethodOrder = testInfo.getTestMethod().map(m -> m.getAnnotation(Order.class).value()).orElseThrow();
assertThat(new File("doc/scenarios/").isDirectory() || new File("doc/scenarios/").mkdirs()).as("mkdir doc/scenarios/").isTrue(); assertThat(new File("doc/scenarios/").isDirectory() || new File("doc/scenarios/").mkdirs()).as("mkdir doc/scenarios/").isTrue();
markdownReport = new PrintWriter(new FileWriter("doc/scenarios/" + testMethodOrder + "-" + testMethodName + ".md")); markdownReportFile = new File("doc/scenarios/" + testMethodOrder + "-" + testMethodName + ".md");
print("## Scenario #" + testInfo.getTestMethod().map(TestReport::orderNumber).orElseThrow() + ": " + markdownReport = new PrintWriter(new FileWriter(markdownReportFile));
testMethodName.replaceAll("([a-z])([A-Z]+)", "$1 $2")); print("## Scenario #" + determineScenarioTitle(testInfo));
} }
@SneakyThrows @SneakyThrows
@ -45,7 +50,7 @@ public class TestReport {
} }
// but the debugLog should contain all output, even if silent // but the debugLog should contain all output, even if silent
markdownLog.append(outputWithCommentsForUuids); markdownLog.print(outputWithCommentsForUuids);
} }
public void printLine(final String output) { public void printLine(final String output) {
@ -59,7 +64,21 @@ public class TestReport {
public void close() { public void close() {
if (markdownReport != null) { if (markdownReport != null) {
markdownReport.close(); markdownReport.close();
System.out.println("SCENARIO REPORT: " + asClickableLink(markdownReportFile));
} }
markdownLog.close();
System.out.println("DEBUG LOG: " + asClickableLink(markdownLogFile));
}
private static @NotNull String determineScenarioTitle(final TestInfo testInfo) {
final var convertedTestMethodName =
testInfo.getTestMethod().map(TestReport::orderNumber).orElseThrow() + ": " +
testInfo.getTestMethod().map(Method::getName).map(t -> t.replaceAll("([a-z])([A-Z]+)", "$1 $2")).orElseThrow();
return convertedTestMethodName.replaceAll(": should ", ": ");
}
private String asClickableLink(final File file) {
return file.toURI().toString().replace("file:/", "file:///");
} }
private static Object orderNumber(final Method method) { private static Object orderNumber(final Method method) {
@ -88,5 +107,4 @@ public class TestReport {
code.run(); code.run();
silent--; silent--;
} }
} }

View File

@ -3,6 +3,7 @@ package net.hostsharing.hsadminng.hs.office.scenarios;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.PathNotFoundException;
import io.restassured.http.ContentType; import io.restassured.http.ContentType;
import lombok.Getter; import lombok.Getter;
import lombok.SneakyThrows; import lombok.SneakyThrows;
@ -81,7 +82,7 @@ public abstract class UseCase<T extends UseCase<?>> {
testReport.silent(() -> testReport.silent(() ->
requirements.forEach((alias, factory) -> { requirements.forEach((alias, factory) -> {
if (!ScenarioTest.containsAlias(alias)) { if (!ScenarioTest.containsAlias(alias)) {
factory.apply(alias).run().keep(); factory.apply(alias).run().keepAs(alias);
} }
}) })
); );
@ -126,7 +127,7 @@ public abstract class UseCase<T extends UseCase<?>> {
} }
public HttpResponse withTitle(final String title, final Supplier<HttpResponse> code) { public HttpResponse withTitle(final String title, final Supplier<HttpResponse> code) {
this.nextTitle = title; this.nextTitle = ScenarioTest.resolve(title);
final var response = code.get(); final var response = code.get();
this.nextTitle = null; this.nextTitle = null;
return response; return response;
@ -276,15 +277,20 @@ public abstract class UseCase<T extends UseCase<?>> {
return this; return this;
} }
public HttpResponse keep() { public HttpResponse keepAs(final String alias) {
final var alias = nextTitle != null ? nextTitle : resultAlias;
assertThat(alias).as("cannot keep result, no alias found").isNotNull();
ScenarioTest.putAlias( ScenarioTest.putAlias(
alias, alias == null ? "unknown alias" : alias, // FIXME
new ScenarioTest.Alias<>(UseCase.this.getClass(), locationUuid)); new ScenarioTest.Alias<>(UseCase.this.getClass(), locationUuid));
return this; return this;
} }
public HttpResponse keep() {
final var alias = nextTitle != null ? nextTitle : resultAlias;
// FIXME assertThat(alias).as("cannot keep result, no title or alias found for locationUuid: " + locationUuid).isNotNull();
return keepAs(alias);
}
@SneakyThrows @SneakyThrows
public HttpResponse expectArrayElements(final int expectedElementCount) { public HttpResponse expectArrayElements(final int expectedElementCount) {
final var rootNode = objectMapper.readTree(response.body()); final var rootNode = objectMapper.readTree(response.body());
@ -305,8 +311,7 @@ public abstract class UseCase<T extends UseCase<?>> {
public <T> Optional<T> getFromBodyAsOptional(final String path) { public <T> Optional<T> getFromBodyAsOptional(final String path) {
try { try {
return Optional.ofNullable(JsonPath.parse(response.body()).read(ScenarioTest.resolve(path))); return Optional.ofNullable(JsonPath.parse(response.body()).read(ScenarioTest.resolve(path)));
} catch (final Exception e) { } catch (final PathNotFoundException e) {
// FIXME: catch more precise exception class
return null; // means the property did not exist at all, not that it was there with value null return null; // means the property did not exist at all, not that it was there with value null
} }
} }

View File

@ -0,0 +1,17 @@
package net.hostsharing.hsadminng.hs.office.scenarios.membership;
import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
public class CreateCoopSharesCancellationTransaction extends CreateCoopSharesTransaction {
public CreateCoopSharesCancellationTransaction(final ScenarioTest testSuite) {
super(testSuite);
}
@Override
protected HttpResponse run() {
given("transactionType", "CANCELLATION");
given("shareCount", "-%{sharesToCancel}");
return super.run();
}
}

View File

@ -0,0 +1,27 @@
package net.hostsharing.hsadminng.hs.office.scenarios.membership;
import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
public class CreateCoopSharesRevertTransaction extends CreateCoopSharesTransaction {
public CreateCoopSharesRevertTransaction(final ScenarioTest testSuite) {
super(testSuite);
requires("CoopShares-Transaction with incorrect shareCount", alias ->
new CreateCoopSharesSubscriptionTransaction(testSuite)
.given("memberNumber", "3101000")
.given("reference", "sign %{dateOfIncorrectTransaction}") // same as revertedShareTx
.given("shareCount", 100)
.given("comment", "reverting subscription transaction with wrong share count")
.given("transactionDate", "%{dateOfIncorrectTransaction}")
);
}
@Override
protected HttpResponse run() {
given("transactionType", "ADJUSTMENT");
given("shareCount", -100);
given("revertedShareTx", uuid("CoopShares-Transaction with incorrect shareCount"));
return super.run();
}
}

View File

@ -0,0 +1,12 @@
package net.hostsharing.hsadminng.hs.office.scenarios.membership;
import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
public class CreateCoopSharesSubscriptionTransaction extends CreateCoopSharesTransaction {
public CreateCoopSharesSubscriptionTransaction(final ScenarioTest testSuite) {
super(testSuite);
given("transactionType", "SUBSCRIPTION");
}
}

View File

@ -8,9 +8,9 @@ import org.springframework.http.HttpStatus;
import static io.restassured.http.ContentType.JSON; import static io.restassured.http.ContentType.JSON;
import static org.springframework.http.HttpStatus.OK; import static org.springframework.http.HttpStatus.OK;
public class CoopSharesTransactionUseCase extends UseCase<CoopSharesTransactionUseCase> { public abstract class CreateCoopSharesTransaction extends UseCase<CreateCoopSharesTransaction> {
public CoopSharesTransactionUseCase(final ScenarioTest testSuite) { public CreateCoopSharesTransaction(final ScenarioTest testSuite) {
super(testSuite); super(testSuite);
} }
@ -23,17 +23,20 @@ public class CoopSharesTransactionUseCase extends UseCase<CoopSharesTransactionU
response -> response.getFromBody("$[0].uuid") response -> response.getFromBody("$[0].uuid")
); );
return httpPost("/api/hs/office/coopsharestransactions", usingJsonBody(""" return withTitle("Create the CoopShares-%{transactionType} Transaction", () ->
httpPost("/api/hs/office/coopsharestransactions", usingJsonBody("""
{ {
"membership.uuid": ${membershipUuid}, "membership.uuid": ${membershipUuid},
"transactionType": ${transactionType}, "transactionType": ${transactionType},
"reference": ${reference}, "reference": ${reference},
"shareCount": ${shareCount}, "shareCount": ${shareCount},
"comment": ${comment}, "comment": ${comment},
"valueDate": ${transactionDate} "valueDate": ${transactionDate},
"revertedShareTx.uuid": ${revertedShareTx???}
} }
""")) """))
.expecting(HttpStatus.CREATED).expecting(ContentType.JSON); .expecting(HttpStatus.CREATED).expecting(ContentType.JSON)
);
} }
@Override @Override
@ -41,8 +44,7 @@ public class CoopSharesTransactionUseCase extends UseCase<CoopSharesTransactionU
verify("Verify Coop-Shares %{transactionType}-Transaction", verify("Verify Coop-Shares %{transactionType}-Transaction",
() -> httpGet("/api/hs/office/coopsharestransactions/" + response.getLocationUuid()) () -> httpGet("/api/hs/office/coopsharestransactions/" + response.getLocationUuid())
.expecting(HttpStatus.OK).expecting(ContentType.JSON), .expecting(HttpStatus.OK).expecting(ContentType.JSON),
// path("transactionType").contains("%{transactionType}"), path("transactionType").contains("%{transactionType}"),
// path("memberNumber").contains("%{memberNumber}"),
path("shareCount").contains("%{shareCount}"), path("shareCount").contains("%{shareCount}"),
path("comment").contains("%{comment}"), path("comment").contains("%{comment}"),
path("valueDate").contains("%{transactionDate}") path("valueDate").contains("%{transactionDate}")