Skip to content

Commit b99dbd8

Browse files
Readded e2e test
1 parent f8b4472 commit b99dbd8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

e2e-tests/src/test/java/uk/nhs/adaptors/gp2gp/e2e/EhrExtractTest.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class EhrExtractTest {
7373
private static final String NHS_NUMBER_MEDICUS_BASED_ON = "9302014592";
7474
private static final String NHS_NUMBER_INVALID_CONTENT_TYPE_DOC = "9817280691";
7575
private static final String NHS_NUMBER_BODY_SITE = "1239577290";
76+
private static final String NHS_NUMBER_NO_CLINICAL_CONTENT_STRUCTURE = "9736435687";
7677
private static final String EHR_EXTRACT_REQUEST_TEST_FILE = "/ehrExtractRequest.json";
7778
private static final String EHR_EXTRACT_REQUEST_WITHOUT_NHS_NUMBER_TEST_FILE = "/ehrExtractRequestWithoutNhsNumber.json";
7879
private static final String EHR_EXTRACT_REQUEST_NO_DOCUMENTS = "/ehrExtractRequestWithNoDocuments.json";
@@ -442,6 +443,30 @@ void When_ExtractRequestReceivedForMedicusPatientWithBasedOn_Expect_ExtractStatu
442443

443444
}
444445

446+
@Test
447+
void When_ExtractRequestReceivedForPatientWithoutClinicalContent_Expect_ExtractStatusAndDocumentDataAddedToDbAndReturnCode10() throws Exception {
448+
String conversationId = UUID.randomUUID().toString();
449+
String ehrExtractRequest = buildEhrExtractRequest(conversationId, NHS_NUMBER_NO_CLINICAL_CONTENT_STRUCTURE, FROM_ODS_CODE_1);
450+
MessageQueue.sendToMhsInboundQueue(ehrExtractRequest);
451+
452+
var requestJournal = waitFor(() -> {
453+
try {
454+
return mhsMockRequestsJournal.getRequestsJournal(conversationId);
455+
} catch (IOException | InterruptedException e) {
456+
throw new RuntimeException(e);
457+
}
458+
});
459+
460+
assertThat(requestJournal).hasSize(1);
461+
462+
var ehrExtractStatus = waitFor(() -> Mongo.findEhrExtractStatus(conversationId));
463+
assertThatInitialRecordWasCreated(conversationId, ehrExtractStatus, NHS_NUMBER_NO_CLINICAL_CONTENT_STRUCTURE, FROM_ODS_CODE_1);
464+
465+
var error = (Document) ehrExtractStatus.get("error");
466+
assertThat(error).isNotEmpty();
467+
softly.assertThat(error.get("code")).isEqualTo(NACK_CODE_FAILED_TO_GENERATE_EHR);
468+
}
469+
445470
@Test
446471
void When_ExtractRequestReceivedForEMISPWTP2_Expect_ExtractStatusAndDocumentDataAddedToDatabase() throws IOException, NamingException, JMSException {
447472
String conversationId = UUID.randomUUID().toString();

0 commit comments

Comments
 (0)