feature/use-case-acceptance-tests-2 #117

Merged
hsh-michaelhoennig merged 38 commits from feature/use-case-acceptance-tests-2 into master 2024-11-05 13:58:39 +01:00
4 changed files with 14 additions and 7 deletions
Showing only changes of commit f3c52c417b - Show all commits

View File

@ -196,10 +196,10 @@ public abstract class UseCase<T extends UseCase<?>> {
protected void verify(
final String title,
final Supplier<UseCase.HttpResponse> http,
final Consumer<UseCase.HttpResponse> assertion) {
final Consumer<UseCase.HttpResponse>... assertions) {
withTitle(ScenarioTest.resolve(title), () -> {
final var response = http.get();
assertion.accept(response);
Arrays.stream(assertions).forEach(assertion -> assertion.accept(response));
return response;
});
}

View File

@ -69,7 +69,7 @@ public class AddRepresentativeToPartner extends UseCase<AddRepresentativeToPartn
@Override
protected void verify() {
verify(
"Verify the New REPRESENTATIVE Relation",
"Verify the REPRESENTATIVE Relation Got Removed",
() -> httpGet("/api/hs/office/relations?relationType=REPRESENTATIVE&personData=" + uriEncoded("%{representativeFamilyName}"))
.expecting(OK).expecting(JSON).expectArrayElements(1),
path("[0].contact.caption").contains("%{representativeGivenName} %{representativeFamilyName}")

View File

@ -78,8 +78,7 @@ public class CreatePartner extends UseCase<CreatePartner> {
verify(
"Verify the New Partner Relation",
() -> httpGet("/api/hs/office/relations?relationType=PARTNER&personData=" + uriEncoded("%{%{tradeName???}???%{givenName???} %{familyName???}}"))
.expecting(OK).expecting(JSON).expectArrayElements(1),
path("[0].contact.caption").contains("%{contactCaption}")
.expecting(OK).expecting(JSON).expectArrayElements(1)
);
}
}

View File

@ -25,11 +25,19 @@ public class RemoveOperationsContactFromPartner extends UseCase<RemoveOperations
"In production, data this query could result in multiple outputs. In that case, you have to find out which is the right one."
);
withTitle("Delete the Contact", () ->
return withTitle("Delete the Contact", () ->
httpDelete("/api/hs/office/relations/&{Operations-Contact: %{operationsContactPerson}}")
.expecting(NO_CONTENT)
);
}
return null;
@Override
protected void verify() {
verify(
"Verify the New OPERATIONS Relation",
() -> httpGet("/api/hs/office/relations?relationType=OPERATIONS&personData=" + uriEncoded(
"%{operationsContactFamilyName}"))
.expecting(OK).expecting(JSON).expectArrayElements(0)
);
}
}