From 876b3c526e1500bce2f038df9f6234badffe3bd7 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Tue, 22 Oct 2024 15:23:38 +0200 Subject: [PATCH] get rid of requires method --- .../hs/office/usecases/HsOfficeUseCasesTest.java | 5 ++++- .../hsadminng/hs/office/usecases/UseCase.java | 8 -------- .../hsadminng/hs/office/usecases/UseCaseTest.java | 9 +++++++++ .../debitor/CreateExternalDebitorForPartner.java | 1 - .../usecases/debitor/CreateSelfDebitorForPartner.java | 2 -- .../office/usecases/membership/CreateMembership.java | 10 ++++------ 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/HsOfficeUseCasesTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/HsOfficeUseCasesTest.java index eba77db6..1f1d4071 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/HsOfficeUseCasesTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/HsOfficeUseCasesTest.java @@ -99,7 +99,10 @@ class HsOfficeUseCasesTest extends UseCaseTest { @Requires("Partner: Test AG") void shouldCreateMembershipForPartner() { new CreateMembership(this) - + .given("partnerName", "Test AG") + .given("memberNumberSuffix", "00") + .given("validFrom", "2024-10-15") + .given("membershipFeeBillable", "true") .doRun(); } } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCase.java b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCase.java index 70ae7401..7efc2ba4 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCase.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCase.java @@ -14,7 +14,6 @@ import java.util.UUID; import java.util.function.Function; import java.util.function.Supplier; -import static org.assertj.core.api.Assumptions.assumeThat; import static org.hamcrest.Matchers.startsWith; public abstract class UseCase> { @@ -44,13 +43,6 @@ public abstract class UseCase> { } } - public void requires(final String alias) { - assumeThat(UseCaseTest.containsAlias(alias)) - .as("skipping because alias '" + alias + "' not found, @Produces(...) missing?") - .isTrue(); - log("depends on [" + alias + "](" + UseCaseTest.getAlias(alias).useCase().getSimpleName() + ".md)"); - } - public final HttpResponse doRun() { log("### Given Properties\n"); log(""" diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCaseTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCaseTest.java index a9a1b55e..75eb73fb 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCaseTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCaseTest.java @@ -123,6 +123,15 @@ public abstract class UseCaseTest extends ContextBasedTest { } } } + + + +// public void requires(final String alias) { +// assumeThat(UseCaseTest.containsAlias(alias)) +// .as("skipping because alias '" + alias + "' not found, @Produces(...) missing?") +// .isTrue(); +// log("depends on [" + alias + "](" + UseCaseTest.getAlias(alias).useCase().getSimpleName() + ".md)"); +// } } private Set allOf(final String value, final String explicitly, final String[] implicitly) { diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateExternalDebitorForPartner.java b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateExternalDebitorForPartner.java index c8a80336..bc446871 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateExternalDebitorForPartner.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateExternalDebitorForPartner.java @@ -12,7 +12,6 @@ public class CreateExternalDebitorForPartner extends UseCase new CreatePerson(testSuite, alias) .given("personType", "LEGAL_PERSON") .given("tradeName", "Billing GmbH") diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateSelfDebitorForPartner.java b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateSelfDebitorForPartner.java index c210ace5..99e9e447 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateSelfDebitorForPartner.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateSelfDebitorForPartner.java @@ -10,8 +10,6 @@ public class CreateSelfDebitorForPartner extends UseCase { public CreateMembership(final UseCaseTest testSuite) { super(testSuite); - - requires("Partner: Test AG"); } @Override protected HttpResponse run() { - keep("Membership: Test AG 00", () -> + keep("Membership: %{partnerName} 00", () -> httpPost("/api/hs/office/memberships", usingJsonBody(""" { "partnerUuid": ${Partner: Test AG}, - "memberNumberSuffix": "00", - "validFrom": "2024-10-15", - "membershipFeeBillable": "true" + "memberNumberSuffix": ${memberNumberSuffix}, + "validFrom": ${validFrom}, + "membershipFeeBillable": ${membershipFeeBillable} } """)) .expecting(HttpStatus.CREATED).expecting(ContentType.JSON)