verify RemoveOperationsContactFromPartner

This commit is contained in:
Michael Hoennig 2024-11-05 09:30:24 +01:00
parent 09b104bb83
commit f3c52c417b
4 changed files with 14 additions and 7 deletions

View File

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

View File

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

View File

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

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." "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}}") httpDelete("/api/hs/office/relations/&{Operations-Contact: %{operationsContactPerson}}")
.expecting(NO_CONTENT) .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)
);
} }
} }