feature/use-case-acceptance-tests #116

Merged
hsh-michaelhoennig merged 49 commits from feature/use-case-acceptance-tests into master 2024-10-30 11:40:46 +01:00
6 changed files with 17 additions and 18 deletions
Showing only changes of commit 876b3c526e - Show all commits

View File

@ -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();
}
}

View File

@ -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("""

View File

@ -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) {

View File

@ -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")

View File

@ -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

View File

@ -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)