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 @Override
protected void verify(final UseCase<ReplaceDeceasedPartnerWithCommunityOfHeirs>.HttpResponse response) { protected void verify(final UseCase<ReplaceDeceasedPartnerWithCommunityOfHeirs>.HttpResponse response) {
verify( verify(
"Verify the New Partner Relation", "Verify the Updated Partner",
() -> httpGet("/api/hs/office/relations?relationType=PARTNER&contactData=Erbengemeinschaft%20&{nameOfDeceasedPerson}") () -> httpGet("/api/hs/office/partners/%{partnerNumber}")
.expecting(OK).expecting(JSON).expectArrayElements(1) .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; 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 @SneakyThrows
public <V> V getFromBody(final String path) { public <V> V getFromBody(final String path) {
final var body = response.body(); final var body = response.body();