From fde50a045410e812d75d62cf0f71cfe070ccc77b Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 24 Oct 2024 16:04:55 +0200 Subject: [PATCH] README and refactoring to scenario and Spring REST client --- .../hsadminng/arch/ArchitectureTest.java | 4 +- .../HsOfficeScenarioTests.java} | 32 ++--- .../MethodReferenceExample.java | 2 +- .../{usecases => scenarios}/Produces.java | 2 +- .../hsadminng/hs/office/scenarios/README.md | 66 ++++++++++ .../{usecases => scenarios}/Requires.java | 2 +- .../ScenarioTest.java} | 14 +-- .../TemplateResolver.java | 2 +- .../{usecases => scenarios}/UseCase.java | 116 +++++++++--------- .../CreateExternalDebitorForPartner.java | 10 +- .../debitor/CreateSelfDebitorForPartner.java | 8 +- .../debitor/CreateSepaMandataForDebitor.java | 8 +- .../debitor/DeleteDebitor.java | 8 +- .../debitor/DeleteSepaMandataForDebitor.java | 8 +- .../InvalidateSepaMandateForDebitor.java | 8 +- .../membership/CreateMembership.java | 8 +- .../AddOperationsContactToPartner.java | 8 +- .../partner/AddRepresentativeToPartner.java | 8 +- .../partner/CreatePartner.java | 10 +- .../partner/DeletePartner.java | 8 +- .../person/CreatePerson.java | 8 +- .../RemoveOperationsContactFromPartner.java | 8 +- .../subscription/SubscribeToMailinglist.java | 8 +- .../UnsubscribeFromMailinglist.java | 8 +- 24 files changed, 216 insertions(+), 148 deletions(-) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases/HsOfficeUseCasesTest.java => scenarios/HsOfficeScenarioTests.java} (84%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/MethodReferenceExample.java (95%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/Produces.java (89%) create mode 100644 src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/README.md rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/Requires.java (83%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases/UseCaseTest.java => scenarios/ScenarioTest.java} (94%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/TemplateResolver.java (98%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/UseCase.java (62%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/debitor/CreateExternalDebitorForPartner.java (88%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/debitor/CreateSelfDebitorForPartner.java (88%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/debitor/CreateSepaMandataForDebitor.java (82%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/debitor/DeleteDebitor.java (80%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/debitor/DeleteSepaMandataForDebitor.java (59%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/debitor/InvalidateSepaMandateForDebitor.java (67%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/membership/CreateMembership.java (75%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/partner/AddOperationsContactToPartner.java (90%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/partner/AddRepresentativeToPartner.java (90%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/partner/CreatePartner.java (84%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/partner/DeletePartner.java (73%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/person/CreatePerson.java (67%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/subscription/RemoveOperationsContactFromPartner.java (58%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/subscription/SubscribeToMailinglist.java (87%) rename src/test/java/net/hostsharing/hsadminng/hs/office/{usecases => scenarios}/subscription/UnsubscribeFromMailinglist.java (57%) diff --git a/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java b/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java index 159b0d1c..3c3cae0c 100644 --- a/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java +++ b/src/test/java/net/hostsharing/hsadminng/arch/ArchitectureTest.java @@ -55,7 +55,7 @@ public class ArchitectureTest { "..hs.office.coopshares", "..hs.office.debitor", "..hs.office.membership", - "..hs.office.usecases..", + "..hs.office.scenarios..", "..hs.migration", "..hs.office.partner", "..hs.office.person", @@ -98,7 +98,7 @@ public class ArchitectureTest { public static final ArchRule testClassesAreProperlyNamed = classes() .that().haveSimpleNameEndingWith("Test") .and().doNotHaveModifier(ABSTRACT) - .should().haveNameMatching(".*(UnitTest|RestTest|IntegrationTest|AcceptanceTest|UseCasesTest|ArchitectureTest)$"); + .should().haveNameMatching(".*(UnitTest|RestTest|IntegrationTest|AcceptanceTest|ScenarioTest|ArchitectureTest)$"); @ArchTest @SuppressWarnings("unused") diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/HsOfficeUseCasesTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/HsOfficeScenarioTests.java similarity index 84% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/HsOfficeUseCasesTest.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/HsOfficeScenarioTests.java index 38dc70cd..583726fc 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/HsOfficeUseCasesTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/HsOfficeScenarioTests.java @@ -1,20 +1,20 @@ -package net.hostsharing.hsadminng.hs.office.usecases; +package net.hostsharing.hsadminng.hs.office.scenarios; import net.hostsharing.hsadminng.HsadminNgApplication; -import net.hostsharing.hsadminng.hs.office.usecases.debitor.CreateExternalDebitorForPartner; -import net.hostsharing.hsadminng.hs.office.usecases.debitor.CreateSelfDebitorForPartner; -import net.hostsharing.hsadminng.hs.office.usecases.debitor.CreateSepaMandataForDebitor; -import net.hostsharing.hsadminng.hs.office.usecases.debitor.DeleteSepaMandataForDebitor; -import net.hostsharing.hsadminng.hs.office.usecases.debitor.InvalidateSepaMandateForDebitor; -import net.hostsharing.hsadminng.hs.office.usecases.membership.CreateMembership; -import net.hostsharing.hsadminng.hs.office.usecases.partner.AddOperationsContactToPartner; -import net.hostsharing.hsadminng.hs.office.usecases.partner.CreatePartner; -import net.hostsharing.hsadminng.hs.office.usecases.debitor.DeleteDebitor; -import net.hostsharing.hsadminng.hs.office.usecases.partner.DeletePartner; -import net.hostsharing.hsadminng.hs.office.usecases.partner.AddRepresentativeToPartner; -import net.hostsharing.hsadminng.hs.office.usecases.subscription.RemoveOperationsContactFromPartner; -import net.hostsharing.hsadminng.hs.office.usecases.subscription.SubscribeToMailinglist; -import net.hostsharing.hsadminng.hs.office.usecases.subscription.UnsubscribeFromMailinglist; +import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateExternalDebitorForPartner; +import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateSelfDebitorForPartner; +import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateSepaMandataForDebitor; +import net.hostsharing.hsadminng.hs.office.scenarios.debitor.DeleteSepaMandataForDebitor; +import net.hostsharing.hsadminng.hs.office.scenarios.debitor.InvalidateSepaMandateForDebitor; +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.CreatePartner; +import net.hostsharing.hsadminng.hs.office.scenarios.debitor.DeleteDebitor; +import net.hostsharing.hsadminng.hs.office.scenarios.partner.DeletePartner; +import net.hostsharing.hsadminng.hs.office.scenarios.partner.AddRepresentativeToPartner; +import net.hostsharing.hsadminng.hs.office.scenarios.subscription.RemoveOperationsContactFromPartner; +import net.hostsharing.hsadminng.hs.office.scenarios.subscription.SubscribeToMailinglist; +import net.hostsharing.hsadminng.hs.office.scenarios.subscription.UnsubscribeFromMailinglist; import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; @@ -29,7 +29,7 @@ import org.springframework.boot.test.context.SpringBootTest; ) @Tag("useCaseTest") @TestMethodOrder(MethodOrderer.OrderAnnotation.class) -class HsOfficeUseCasesTest extends UseCaseTest { +class HsOfficeScenarioTests extends ScenarioTest { @Test @Order(1010) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/MethodReferenceExample.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/MethodReferenceExample.java similarity index 95% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/MethodReferenceExample.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/MethodReferenceExample.java index baafe9c2..b5f993d0 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/MethodReferenceExample.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/MethodReferenceExample.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.hs.office.usecases; +package net.hostsharing.hsadminng.hs.office.scenarios; import java.lang.invoke.SerializedLambda; import java.lang.reflect.Method; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/Produces.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/Produces.java similarity index 89% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/Produces.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/Produces.java index 4c2b526a..07bc4e47 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/Produces.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/Produces.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.hs.office.usecases; +package net.hostsharing.hsadminng.hs.office.scenarios; import java.lang.annotation.Retention; import java.lang.annotation.Target; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/README.md b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/README.md new file mode 100644 index 00000000..36e7c3c8 --- /dev/null +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/README.md @@ -0,0 +1,66 @@ +# UseCase-Tests + +We define UseCase-tests as test for business-scenarios. +They test positive (successful) scenarios by using the REST-API. + +Running these tests also creates test-reports which can be used as documentation about the necessary REST-calls for each scenario. + +Clarification: Acceptance tests also test at the REST-API level but are more technical and also test negative (error-) scenarios. + +## ... extends ScenarioTest + +Each test-method in subclasses of ScenarioTest describes a business-scenario, +each utilizing a main-use-case and given example data for the scenario. + +To reduce the number of API-calls, intermediate results can be re-used. +This is controlled by two annotations: + +### @Produces(....) + +This annotation tells the test-runner that this scenario produces certain business object for re-use. +The UUID of the new business objects are stored in a key-value map using the provided keys. + +There are two variants of this annotation: + +#### A Single Business Object +``` +@Produces("key") +``` + +This variant is used when there is just a single business-object produced by the use-case. + +#### Multiple Business Objects + +``` +@Produces(explicitly = "main-key", implicitly = {"other-key", ...}) +``` + +This variant is used when multiple business-objects are produced by the use-case, +e.g. a Relation, a Person and a Contact. +The UUID of the business-object produced by the main-use-case gets stored as the key after "explicitly", +the others are listed after "implicitly"; +if there is just one, leave out the surrounding braces. + +### @Requires(...) + +This annotation tells the test-runner that which business objects are required before this scenario can run. + +Each subset must be produced by the same producer-method. + + +## ... extends UseCase + +These classes consist of two parts: + +### Prerequisites of the Use-Case + +The constructor may create prerequisites via `required(...)`. +These do not really belong to the use-case itself, +e.g. create business objects which, in the context of that use-case, would already exist. + +This is similar to @Requires(...) just that no other test scenario produces this prerequisite. +Here, use-cases can be re-used, usually with different data. + +### The Use-Case Itself + +The use-case diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/Requires.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/Requires.java similarity index 83% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/Requires.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/Requires.java index 0ca11334..59ea21ec 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/Requires.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/Requires.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.hs.office.usecases; +package net.hostsharing.hsadminng.hs.office.scenarios; import java.lang.annotation.Retention; import java.lang.annotation.Target; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCaseTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/ScenarioTest.java similarity index 94% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCaseTest.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/ScenarioTest.java index bf291a98..d4cd93f0 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCaseTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/ScenarioTest.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.hs.office.usecases; +package net.hostsharing.hsadminng.hs.office.scenarios; import lombok.Getter; import lombok.SneakyThrows; @@ -32,7 +32,7 @@ import static java.util.Arrays.asList; import static java.util.Optional.ofNullable; import static org.assertj.core.api.Assertions.assertThat; -public abstract class UseCaseTest extends ContextBasedTest { +public abstract class ScenarioTest extends ContextBasedTest { final static String RUN_AS_USER = "superuser-alex@hostsharing.net"; // TODO.test: use global:AGENT when implemented //String producesAlias; @@ -75,7 +75,7 @@ public abstract class UseCaseTest extends ContextBasedTest { void print(final String output) { // for tests executed due to @Requires/@Produces there is no markdownFile yet if (markdownFile != null) { - markdownFile.println(output); + markdownFile.print(output); } } @@ -108,7 +108,7 @@ public abstract class UseCaseTest extends ContextBasedTest { final var testMethodName = testInfo.getTestMethod().map(Method::getName).orElseThrow(); final var testMethodOrder = testInfo.getTestMethod().map(m -> m.getAnnotation(Order.class).value()).orElseThrow(); markdownFile = new PrintWriter(new FileWriter(testMethodOrder + "-" + testMethodName + ".md")); - print("## Testcase: " + testMethodName.replaceAll("([a-z])([A-Z]+)", "$1 $2")); + print("## Scenario: " + testMethodName.replaceAll("([a-z])([A-Z]+)", "$1 $2")); } @SneakyThrows @@ -178,13 +178,13 @@ public abstract class UseCaseTest extends ContextBasedTest { static Map knowVariables() { final var map = new LinkedHashMap(); - UseCaseTest.aliases.forEach((key, value) -> map.put(key, value.uuid())); - map.putAll(UseCaseTest.properties); + ScenarioTest.aliases.forEach((key, value) -> map.put(key, value.uuid())); + map.putAll(ScenarioTest.properties); return map; } static String resolve(final String text) { - final var resolved = new TemplateResolver(text, UseCaseTest.knowVariables()).resolve(); + final var resolved = new TemplateResolver(text, ScenarioTest.knowVariables()).resolve(); return resolved; } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/TemplateResolver.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/TemplateResolver.java similarity index 98% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/TemplateResolver.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/TemplateResolver.java index 7934f064..98cafcaa 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/TemplateResolver.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/TemplateResolver.java @@ -1,4 +1,4 @@ -package net.hostsharing.hsadminng.hs.office.usecases; +package net.hostsharing.hsadminng.hs.office.scenarios; import java.util.Map; diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCase.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/UseCase.java similarity index 62% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCase.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/UseCase.java index 87eb6dad..810102be 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCase.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/UseCase.java @@ -1,9 +1,6 @@ -package net.hostsharing.hsadminng.hs.office.usecases; +package net.hostsharing.hsadminng.hs.office.scenarios; -import io.restassured.RestAssured; import io.restassured.http.ContentType; -import io.restassured.response.Response; -import io.restassured.response.ValidatableResponse; import net.hostsharing.hsadminng.reflection.AnnotationFinder; import org.apache.commons.collections4.map.LinkedMap; import org.hibernate.AssertionFailure; @@ -11,6 +8,9 @@ import org.jetbrains.annotations.Nullable; import org.junit.jupiter.api.Test; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; +import org.springframework.http.ResponseEntity; +import org.springframework.web.client.RestClient; import java.util.LinkedHashMap; import java.util.Map; @@ -19,55 +19,53 @@ import java.util.function.Function; import java.util.function.Supplier; import static org.assertj.core.api.Assertions.assertThat; -import static org.hamcrest.Matchers.startsWith; import static org.junit.platform.commons.util.StringUtils.isBlank; import static org.junit.platform.commons.util.StringUtils.isNotBlank; +import static org.springframework.http.MediaType.APPLICATION_JSON; public abstract class UseCase> { - private final UseCaseTest testSuite; + private static final RestClient restClient = RestClient.create(); + + private final ScenarioTest testSuite; private final Map>> requirements = new LinkedMap<>(); private final String resultAlias; private final Map givenProperties = new LinkedHashMap<>(); private String nextTitle; // FIXME: ugly - public UseCase(final UseCaseTest testSuite) { + public UseCase(final ScenarioTest testSuite) { this(testSuite, getResultAliasFromProducesAnnotationInCallStack()); } - public UseCase(final UseCaseTest testSuite, final String resultAlias) { + public UseCase(final ScenarioTest testSuite, final String resultAlias) { this.testSuite = testSuite; this.resultAlias = resultAlias; if (resultAlias != null) { - printLine("### UseCase: " + resultAlias); + printPara("### UseCase " + title(resultAlias)); } } public final void requires(final String alias, final Function> useCaseFactory) { - if (!UseCaseTest.containsAlias(alias)) { + if (!ScenarioTest.containsAlias(alias)) { requirements.put(alias, useCaseFactory); } } public final HttpResponse doRun() { - printLine("### Given Properties"); + printPara("### Given Properties"); printLine(""" | name | value | - |------|-------| - """.trim()); + |------|-------|"""); givenProperties.forEach((key, value) -> printLine("| " + key + " | " + value.toString().replace("\n", "
") + " |")); printLine(""); requirements.forEach((alias, factory) -> factory.apply(alias).run().keep()); - - // final var testMethodProduct = testInfo.getTestMethod().map(m -> m.getAnnotation(Produces.class).value()).orElseThrow(); return run(); } - protected abstract HttpResponse run(); public final UseCase given(final String propName, final Object propValue) { givenProperties.put(propName, propValue); - UseCaseTest.putProperty(propName, propValue); + ScenarioTest.putProperty(propName, propValue); return this; } @@ -76,45 +74,43 @@ public abstract class UseCase> { } public final void keep(final String alias, final Supplier http) { - this.nextTitle = UseCaseTest.resolve(alias); + this.nextTitle = ScenarioTest.resolve(alias); http.get().keep(); this.nextTitle = null; } public final HttpResponse httpPost(final String uriPath, final JsonTemplate bodyJsonTemplate) { final var body = bodyJsonTemplate.resolvePlaceholders(); - final var uri = "http://localhost" + uriPath; - final var response = RestAssured.given() - .header("current-subject", UseCaseTest.RUN_AS_USER) - .contentType(ContentType.JSON) + final var response = restClient.post() + .uri("http://localhost:" + testSuite.port + uriPath) + .header("current-subject", ScenarioTest.RUN_AS_USER) + .contentType(APPLICATION_JSON) .body(body) - .port(testSuite.port) - .when().post(uri); + .retrieve(); return new HttpResponse(HttpMethod.POST, uriPath, body, response); } public final HttpResponse httpPatch(final String uriPath, final JsonTemplate bodyJsonTemplate) { final var body = bodyJsonTemplate.resolvePlaceholders(); - final var uri = "http://localhost" + uriPath; - final var response = RestAssured.given() - .header("current-subject", UseCaseTest.RUN_AS_USER) - .contentType(ContentType.JSON) + final var response = restClient.patch() + .uri("http://localhost:" + testSuite.port + uriPath) + .header("current-subject", ScenarioTest.RUN_AS_USER) + .contentType(APPLICATION_JSON) .body(body) - .port(testSuite.port) - .when().patch(uri); + .retrieve(); return new HttpResponse(HttpMethod.PATCH, uriPath, body, response); } public final HttpResponse httpDelete(final String uriPath) { - final var response = RestAssured.given() - .header("current-subject", UseCaseTest.RUN_AS_USER) - .port(testSuite.port) - .when().delete("http://localhost" + uriPath); + final var response = restClient.delete() + .uri("http://localhost:" + testSuite.port + uriPath) + .header("current-subject", ScenarioTest.RUN_AS_USER) + .retrieve(); return new HttpResponse(HttpMethod.DELETE, uriPath, null, response); } public final UUID uuid(final String alias) { - return UseCaseTest.uuid(alias); + return ScenarioTest.uuid(alias); } public static class JsonTemplate { @@ -126,63 +122,65 @@ public abstract class UseCase> { } String resolvePlaceholders() { - return UseCaseTest.resolve(template); + return ScenarioTest.resolve(template); } } public class HttpResponse { - private final ValidatableResponse response; - private final HttpStatus status; + private final ResponseEntity response; + private final HttpStatusCode status; private UUID locationUuid; public HttpResponse( final HttpMethod httpMethod, final String uri, final String requestBody, - final Response response + final RestClient.ResponseSpec responseSpec ) { - final var validatableResponse = response.then(); - this.response = validatableResponse.log().all().assertThat(); - this.status = HttpStatus.valueOf(response.statusCode()); - if (response.statusCode() == HttpStatus.CREATED.value()) { - final var location = validatableResponse.header("Location", startsWith("http://localhost")) - .extract().header("Location"); + response = responseSpec.toEntity(String.class); + status = this.response.getStatusCode(); + if (this.status.value() == HttpStatus.CREATED.value()) { + final var location = response.getHeaders().getLocation().toString(); + assertThat(location).startsWith("http://localhost:"); locationUuid = UUID.fromString(location.substring(location.lastIndexOf('/') + 1)); } if (nextTitle != null) { - print("\n### " + nextTitle + "\n"); + printLine("\n### " + nextTitle + "\n"); } else if (resultAlias != null) { - print("\n### " + resultAlias + "\n"); + printLine("\n### " + resultAlias + "\n"); } - print("```"); - print(httpMethod.name() + " " + uri); - print(requestBody + "=> status: " + status + " " + + printLine("```"); + printLine(httpMethod.name() + " " + uri); + printLine(requestBody + "=> status: " + status + " " + (locationUuid != null ? locationUuid : "")); if (!status.is2xxSuccessful()) { - print(response.getBody().prettyPrint()); + printLine(responseSpec.body(String.class)); // FIXME: prettyPrint } - print("```"); - print(""); + printLine("```"); + printLine(""); } public HttpResponse expecting(final HttpStatus httpStatus) { - response.statusCode(httpStatus.value()); + assertThat(HttpStatus.valueOf(response.getStatusCode().value())).isEqualTo(httpStatus); return this; } public HttpResponse expecting(final ContentType contentType) { - response.contentType(contentType); + assertThat(response.getHeaders().getContentType()) + .isNotNull() + .extracting(Object::toString) + .isEqualTo(contentType.toString()); return this; } public void keep() { final var alias = nextTitle != null ? nextTitle : resultAlias; assertThat(alias).as("cannot keep result, no alias found").isNotNull(); - UseCaseTest.putAlias( + ScenarioTest.putAlias( alias, - new UseCaseTest.Alias<>(UseCase.this.getClass(), locationUuid)); + new ScenarioTest.Alias<>(UseCase.this.getClass(), locationUuid)); } } @@ -217,4 +215,8 @@ public abstract class UseCase> { } throw new AssertionFailure("exactly one value required, but got '" + one + "' and '" + another + "'"); } + + private final String title(String resultAlias) { + return getClass().getSimpleName().replaceAll("([a-z])([A-Z]+)", "$1 $2") + " => " + resultAlias; + } } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateExternalDebitorForPartner.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateExternalDebitorForPartner.java similarity index 88% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateExternalDebitorForPartner.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateExternalDebitorForPartner.java index 9d902dcc..d5a3d8a0 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateExternalDebitorForPartner.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateExternalDebitorForPartner.java @@ -1,15 +1,15 @@ -package net.hostsharing.hsadminng.hs.office.usecases.debitor; +package net.hostsharing.hsadminng.hs.office.scenarios.debitor; -import net.hostsharing.hsadminng.hs.office.usecases.UseCase; -import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; -import net.hostsharing.hsadminng.hs.office.usecases.person.CreatePerson; +import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; +import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; +import net.hostsharing.hsadminng.hs.office.scenarios.person.CreatePerson; import static io.restassured.http.ContentType.JSON; import static org.springframework.http.HttpStatus.CREATED; public class CreateExternalDebitorForPartner extends UseCase { - public CreateExternalDebitorForPartner(final UseCaseTest testSuite) { + public CreateExternalDebitorForPartner(final ScenarioTest testSuite) { super(testSuite); requires("Person: Billing GmbH", alias -> new CreatePerson(testSuite, alias) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateSelfDebitorForPartner.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateSelfDebitorForPartner.java similarity index 88% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateSelfDebitorForPartner.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateSelfDebitorForPartner.java index 99e9e447..f2e49088 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateSelfDebitorForPartner.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateSelfDebitorForPartner.java @@ -1,14 +1,14 @@ -package net.hostsharing.hsadminng.hs.office.usecases.debitor; +package net.hostsharing.hsadminng.hs.office.scenarios.debitor; -import net.hostsharing.hsadminng.hs.office.usecases.UseCase; -import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; +import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; +import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; import static io.restassured.http.ContentType.JSON; import static org.springframework.http.HttpStatus.CREATED; public class CreateSelfDebitorForPartner extends UseCase { - public CreateSelfDebitorForPartner(final UseCaseTest testSuite, final String resultAlias) { + public CreateSelfDebitorForPartner(final ScenarioTest testSuite, final String resultAlias) { super(testSuite, resultAlias); } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateSepaMandataForDebitor.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateSepaMandataForDebitor.java similarity index 82% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateSepaMandataForDebitor.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateSepaMandataForDebitor.java index 33f27d4c..0f1226f7 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateSepaMandataForDebitor.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/CreateSepaMandataForDebitor.java @@ -1,14 +1,14 @@ -package net.hostsharing.hsadminng.hs.office.usecases.debitor; +package net.hostsharing.hsadminng.hs.office.scenarios.debitor; -import net.hostsharing.hsadminng.hs.office.usecases.UseCase; -import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; +import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; +import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; import static io.restassured.http.ContentType.JSON; import static org.springframework.http.HttpStatus.CREATED; public class CreateSepaMandataForDebitor extends UseCase { - public CreateSepaMandataForDebitor(final UseCaseTest testSuite) { + public CreateSepaMandataForDebitor(final ScenarioTest testSuite) { super(testSuite); } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/DeleteDebitor.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/DeleteDebitor.java similarity index 80% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/DeleteDebitor.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/DeleteDebitor.java index 527b23b6..a72b33bb 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/DeleteDebitor.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/DeleteDebitor.java @@ -1,12 +1,12 @@ -package net.hostsharing.hsadminng.hs.office.usecases.debitor; +package net.hostsharing.hsadminng.hs.office.scenarios.debitor; -import net.hostsharing.hsadminng.hs.office.usecases.UseCase; -import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; +import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; +import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; import org.springframework.http.HttpStatus; public class DeleteDebitor extends UseCase { - public DeleteDebitor(final UseCaseTest testSuite) { + public DeleteDebitor(final ScenarioTest testSuite) { super(testSuite); requires("Debitor: Test AG - delete debitor", alias -> new CreateSelfDebitorForPartner(testSuite, alias) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/DeleteSepaMandataForDebitor.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/DeleteSepaMandataForDebitor.java similarity index 59% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/DeleteSepaMandataForDebitor.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/DeleteSepaMandataForDebitor.java index f6d93085..50b81e7e 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/DeleteSepaMandataForDebitor.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/DeleteSepaMandataForDebitor.java @@ -1,13 +1,13 @@ -package net.hostsharing.hsadminng.hs.office.usecases.debitor; +package net.hostsharing.hsadminng.hs.office.scenarios.debitor; -import net.hostsharing.hsadminng.hs.office.usecases.UseCase; -import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; +import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; +import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; import org.springframework.http.HttpStatus; public class DeleteSepaMandataForDebitor extends UseCase { - public DeleteSepaMandataForDebitor(final UseCaseTest testSuite) { + public DeleteSepaMandataForDebitor(final ScenarioTest testSuite) { super(testSuite); } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/InvalidateSepaMandateForDebitor.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/InvalidateSepaMandateForDebitor.java similarity index 67% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/InvalidateSepaMandateForDebitor.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/InvalidateSepaMandateForDebitor.java index ba54e3bb..9d13706e 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/InvalidateSepaMandateForDebitor.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/debitor/InvalidateSepaMandateForDebitor.java @@ -1,14 +1,14 @@ -package net.hostsharing.hsadminng.hs.office.usecases.debitor; +package net.hostsharing.hsadminng.hs.office.scenarios.debitor; -import net.hostsharing.hsadminng.hs.office.usecases.UseCase; -import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; +import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; +import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; import static io.restassured.http.ContentType.JSON; import static org.springframework.http.HttpStatus.OK; public class InvalidateSepaMandateForDebitor extends UseCase { - public InvalidateSepaMandateForDebitor(final UseCaseTest testSuite) { + public InvalidateSepaMandateForDebitor(final ScenarioTest testSuite) { super(testSuite); } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/membership/CreateMembership.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/CreateMembership.java similarity index 75% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/membership/CreateMembership.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/CreateMembership.java index c568ea52..a9fd2b81 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/membership/CreateMembership.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/CreateMembership.java @@ -1,13 +1,13 @@ -package net.hostsharing.hsadminng.hs.office.usecases.membership; +package net.hostsharing.hsadminng.hs.office.scenarios.membership; import io.restassured.http.ContentType; -import net.hostsharing.hsadminng.hs.office.usecases.UseCase; -import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; +import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; +import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; import org.springframework.http.HttpStatus; public class CreateMembership extends UseCase { - public CreateMembership(final UseCaseTest testSuite) { + public CreateMembership(final ScenarioTest testSuite) { super(testSuite); } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/partner/AddOperationsContactToPartner.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/AddOperationsContactToPartner.java similarity index 90% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/partner/AddOperationsContactToPartner.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/AddOperationsContactToPartner.java index 0b436027..69876ba0 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/partner/AddOperationsContactToPartner.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/AddOperationsContactToPartner.java @@ -1,8 +1,8 @@ -package net.hostsharing.hsadminng.hs.office.usecases.partner; +package net.hostsharing.hsadminng.hs.office.scenarios.partner; import io.restassured.http.ContentType; -import net.hostsharing.hsadminng.hs.office.usecases.UseCase; -import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; +import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; +import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; import org.springframework.http.HttpStatus; import static io.restassured.http.ContentType.JSON; @@ -10,7 +10,7 @@ import static org.springframework.http.HttpStatus.CREATED; public class AddOperationsContactToPartner extends UseCase { - public AddOperationsContactToPartner(final UseCaseTest testSuite) { + public AddOperationsContactToPartner(final ScenarioTest testSuite) { super(testSuite); } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/partner/AddRepresentativeToPartner.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/AddRepresentativeToPartner.java similarity index 90% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/partner/AddRepresentativeToPartner.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/AddRepresentativeToPartner.java index 2002f418..9c64dc41 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/partner/AddRepresentativeToPartner.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/AddRepresentativeToPartner.java @@ -1,8 +1,8 @@ -package net.hostsharing.hsadminng.hs.office.usecases.partner; +package net.hostsharing.hsadminng.hs.office.scenarios.partner; import io.restassured.http.ContentType; -import net.hostsharing.hsadminng.hs.office.usecases.UseCase; -import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; +import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; +import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; import org.springframework.http.HttpStatus; import static io.restassured.http.ContentType.JSON; @@ -10,7 +10,7 @@ import static org.springframework.http.HttpStatus.CREATED; public class AddRepresentativeToPartner extends UseCase { - public AddRepresentativeToPartner(final UseCaseTest testSuite) { + public AddRepresentativeToPartner(final ScenarioTest testSuite) { super(testSuite); } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/partner/CreatePartner.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/CreatePartner.java similarity index 84% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/partner/CreatePartner.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/CreatePartner.java index d4dcf0e6..6f42b8e4 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/partner/CreatePartner.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/CreatePartner.java @@ -1,17 +1,17 @@ -package net.hostsharing.hsadminng.hs.office.usecases.partner; +package net.hostsharing.hsadminng.hs.office.scenarios.partner; import io.restassured.http.ContentType; -import net.hostsharing.hsadminng.hs.office.usecases.UseCase; -import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; +import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; +import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; import org.springframework.http.HttpStatus; public class CreatePartner extends UseCase { - public CreatePartner(final UseCaseTest testSuite, final String resultAlias) { + public CreatePartner(final ScenarioTest testSuite, final String resultAlias) { super(testSuite, resultAlias); } - public CreatePartner(final UseCaseTest testSuite) { + public CreatePartner(final ScenarioTest testSuite) { super(testSuite); } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/partner/DeletePartner.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/DeletePartner.java similarity index 73% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/partner/DeletePartner.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/DeletePartner.java index b6f963bc..ae24dfd1 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/partner/DeletePartner.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/partner/DeletePartner.java @@ -1,12 +1,12 @@ -package net.hostsharing.hsadminng.hs.office.usecases.partner; +package net.hostsharing.hsadminng.hs.office.scenarios.partner; -import net.hostsharing.hsadminng.hs.office.usecases.UseCase; -import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; +import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; +import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; import org.springframework.http.HttpStatus; public class DeletePartner extends UseCase { - public DeletePartner(final UseCaseTest testSuite) { + public DeletePartner(final ScenarioTest testSuite) { super(testSuite); requires("Partner: Delete AG", alias -> new CreatePartner(testSuite, alias) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/person/CreatePerson.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/person/CreatePerson.java similarity index 67% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/person/CreatePerson.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/person/CreatePerson.java index 661f73b8..56db97e8 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/person/CreatePerson.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/person/CreatePerson.java @@ -1,13 +1,13 @@ -package net.hostsharing.hsadminng.hs.office.usecases.person; +package net.hostsharing.hsadminng.hs.office.scenarios.person; import io.restassured.http.ContentType; -import net.hostsharing.hsadminng.hs.office.usecases.UseCase; -import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; +import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; +import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; import org.springframework.http.HttpStatus; public class CreatePerson extends UseCase { - public CreatePerson(final UseCaseTest testSuite, final String resultAlias) { + public CreatePerson(final ScenarioTest testSuite, final String resultAlias) { super(testSuite, resultAlias); } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/subscription/RemoveOperationsContactFromPartner.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/subscription/RemoveOperationsContactFromPartner.java similarity index 58% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/subscription/RemoveOperationsContactFromPartner.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/subscription/RemoveOperationsContactFromPartner.java index 7e5b0888..f11fcaac 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/subscription/RemoveOperationsContactFromPartner.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/subscription/RemoveOperationsContactFromPartner.java @@ -1,13 +1,13 @@ -package net.hostsharing.hsadminng.hs.office.usecases.subscription; +package net.hostsharing.hsadminng.hs.office.scenarios.subscription; -import net.hostsharing.hsadminng.hs.office.usecases.UseCase; -import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; +import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; +import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; import static org.springframework.http.HttpStatus.NO_CONTENT; public class RemoveOperationsContactFromPartner extends UseCase { - public RemoveOperationsContactFromPartner(final UseCaseTest testSuite) { + public RemoveOperationsContactFromPartner(final ScenarioTest testSuite) { super(testSuite); } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/subscription/SubscribeToMailinglist.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/subscription/SubscribeToMailinglist.java similarity index 87% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/subscription/SubscribeToMailinglist.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/subscription/SubscribeToMailinglist.java index 0b1654e7..4079e6b6 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/subscription/SubscribeToMailinglist.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/subscription/SubscribeToMailinglist.java @@ -1,8 +1,8 @@ -package net.hostsharing.hsadminng.hs.office.usecases.subscription; +package net.hostsharing.hsadminng.hs.office.scenarios.subscription; import io.restassured.http.ContentType; -import net.hostsharing.hsadminng.hs.office.usecases.UseCase; -import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; +import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; +import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; import org.springframework.http.HttpStatus; import static io.restassured.http.ContentType.JSON; @@ -10,7 +10,7 @@ import static org.springframework.http.HttpStatus.CREATED; public class SubscribeToMailinglist extends UseCase { - public SubscribeToMailinglist(final UseCaseTest testSuite) { + public SubscribeToMailinglist(final ScenarioTest testSuite) { super(testSuite); } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/subscription/UnsubscribeFromMailinglist.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/subscription/UnsubscribeFromMailinglist.java similarity index 57% rename from src/test/java/net/hostsharing/hsadminng/hs/office/usecases/subscription/UnsubscribeFromMailinglist.java rename to src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/subscription/UnsubscribeFromMailinglist.java index b2ed2a7d..b0754161 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/subscription/UnsubscribeFromMailinglist.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/subscription/UnsubscribeFromMailinglist.java @@ -1,13 +1,13 @@ -package net.hostsharing.hsadminng.hs.office.usecases.subscription; +package net.hostsharing.hsadminng.hs.office.scenarios.subscription; -import net.hostsharing.hsadminng.hs.office.usecases.UseCase; -import net.hostsharing.hsadminng.hs.office.usecases.UseCaseTest; +import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; +import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; import static org.springframework.http.HttpStatus.NO_CONTENT; public class UnsubscribeFromMailinglist extends UseCase { - public UnsubscribeFromMailinglist(final UseCaseTest testSuite) { + public UnsubscribeFromMailinglist(final ScenarioTest testSuite) { super(testSuite); }