feature/use-case-acceptance-tests-2 #117
@ -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;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -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}")
|
||||||
|
@ -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}")
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user