feature/use-case-acceptance-tests #116
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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<T extends UseCase<?>> {
|
||||
@ -44,13 +43,6 @@ public abstract class UseCase<T extends 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("""
|
||||
|
@ -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<String> allOf(final String value, final String explicitly, final String[] implicitly) {
|
||||
|
@ -12,7 +12,6 @@ public class CreateExternalDebitorForPartner extends UseCase<CreateExternalDebit
|
||||
public CreateExternalDebitorForPartner(final UseCaseTest testSuite, final String resultAlias) {
|
||||
super(testSuite, resultAlias);
|
||||
|
||||
requires("Person: Test AG");
|
||||
requires("Person: Billing GmbH", alias -> new CreatePerson(testSuite, alias)
|
||||
.given("personType", "LEGAL_PERSON")
|
||||
.given("tradeName", "Billing GmbH")
|
||||
|
@ -10,8 +10,6 @@ public class CreateSelfDebitorForPartner extends UseCase<CreateSelfDebitorForPar
|
||||
|
||||
public CreateSelfDebitorForPartner(final UseCaseTest testSuite, final String resultAlias) {
|
||||
super(testSuite, resultAlias);
|
||||
|
||||
requires("Person: Test AG");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -9,19 +9,17 @@ public class CreateMembership extends UseCase<CreateMembership> {
|
||||
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user