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