verify community of heirs to be the new holder of the partnerRel - currently failing

This commit is contained in:
Michael Hoennig 2024-12-06 16:19:09 +01:00
parent 781fcef1d3
commit e4e509a23a
2 changed files with 11 additions and 3 deletions

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();