feature/add-scenario-test-for-deceased-partner-with-community-of-heirs #137

Merged
2 changed files with 11 additions and 3 deletions
Showing only changes of commit e4e509a23a - Show all commits

View File

@ -76,9 +76,10 @@ public class ReplaceDeceasedPartnerWithCommunityOfHeirs extends UseCase<ReplaceD
@Override
protected void verify(final UseCase<ReplaceDeceasedPartnerWithCommunityOfHeirs>.HttpResponse response) {
verify(
"Verify the New Partner Relation",
() -> httpGet("/api/hs/office/relations?relationType=PARTNER&contactData=Erbengemeinschaft%20&{nameOfDeceasedPerson}")
.expecting(OK).expecting(JSON).expectArrayElements(1)
"Verify the Updated Partner",
() -> httpGet("/api/hs/office/partners/%{partnerNumber}")
.expecting(OK).expecting(JSON).expectObject(),
path("partnerRel.holder.tradeName").contains("Erbengemeinschaft %{nameOfDeceasedPerson}")
);
}
}

View File

@ -335,6 +335,13 @@ public abstract class UseCase<T extends UseCase<?>> {
return this;
}
@SneakyThrows
public HttpResponse expectObject() {
final var rootNode = objectMapper.readTree(response.body());
assertThat(rootNode.isArray()).as("object expected, but got array: " + response.body()).isFalse();
return this;
}
@SneakyThrows
public <V> V getFromBody(final String path) {
final var body = response.body();