From 9b26efcb421ab2bd4d2a6991cd337f87a33bde07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= Date: Thu, 5 Sep 2024 17:22:38 +0200 Subject: [PATCH] Asserts all resource have been created --- ...estionnaireVsQuestionnaireResponseIntegrationTest.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/integration/QuestionnaireVsQuestionnaireResponseIntegrationTest.java b/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/integration/QuestionnaireVsQuestionnaireResponseIntegrationTest.java index 7c35a11ec..b2d88268b 100644 --- a/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/integration/QuestionnaireVsQuestionnaireResponseIntegrationTest.java +++ b/dsf-fhir/dsf-fhir-server/src/test/java/dev/dsf/fhir/integration/QuestionnaireVsQuestionnaireResponseIntegrationTest.java @@ -1,7 +1,9 @@ package dev.dsf.fhir.integration; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import java.util.Objects; import java.util.Optional; import java.util.UUID; @@ -168,7 +170,8 @@ public void testPostQuestionnaireAndCorrespondingQuestionnaireResponseInTransact bundle.addEntry().setResource(questionnaireResponse).setFullUrl("urn:uuid:" + questionnaireResponse.getId()) .getRequest().setMethod(Bundle.HTTPVerb.POST).setUrl(ResourceType.QuestionnaireResponse.name()); - assertNotNull(getWebserviceClient().postBundle(bundle)); + assertTrue(getWebserviceClient().postBundle(bundle).getEntry().stream() + .allMatch(entry -> entry.getResponse().getStatus().equals("201 Created"))); } @Test @@ -188,6 +191,7 @@ public void testPostQuestionnaireAndCorrespondingQuestionnaireResponseInTransact bundle.addEntry().setResource(questionnaire).setFullUrl("urn:uuid:" + questionnaire.getId()).getRequest() .setMethod(Bundle.HTTPVerb.POST).setUrl(ResourceType.Questionnaire.name()); - assertNotNull(getWebserviceClient().postBundle(bundle)); + assertTrue(getWebserviceClient().postBundle(bundle).getEntry().stream() + .allMatch(entry -> entry.getResponse().getStatus().equals("201 Created"))); } } \ No newline at end of file