Skip to content

Commit 6365d38

Browse files
Added e2e test
1 parent ac2dec3 commit 6365d38

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class EhrExtractTest {
7272
private static final String NHS_NUMBER_RESPONSE_MISSING_PATIENT_RESOURCE = "2906543841";
7373
private static final String NHS_NUMBER_MEDICUS_BASED_ON = "9302014592";
7474
private static final String NHS_NUMBER_INVALID_CONTENT_TYPE_DOC = "9817280691";
75+
private static final String NHS_NUMBER_NO_CLINICAL_CONTENT_STRUCTURE = "9736435687";
7576
private static final String NHS_NUMBER_BODY_SITE = "1239577290";
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";
@@ -442,6 +443,19 @@ 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 ehrExtractStatus = waitFor(() -> Mongo.findEhrExtractStatus(conversationId));
453+
assertThatInitialRecordWasCreated(conversationId, ehrExtractStatus, NHS_NUMBER_NO_CLINICAL_CONTENT_STRUCTURE, FROM_ODS_CODE_1);
454+
455+
var error = (Document) ehrExtractStatus.get("error");
456+
softly.assertThat(error.get("code")).isEqualTo(NACK_CODE_FAILED_TO_GENERATE_EHR);
457+
}
458+
445459
@Test
446460
void When_ExtractRequestReceivedForEMISPWTP2_Expect_ExtractStatusAndDocumentDataAddedToDatabase() throws IOException, NamingException, JMSException {
447461
String conversationId = UUID.randomUUID().toString();

service/src/intTest/java/uk/nhs/adaptors/gp2gp/ehr/SendEhrExtractCoreComponentTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
import uk.nhs.adaptors.gp2gp.mhs.MhsRequestBuilder;
5353
import uk.nhs.adaptors.gp2gp.mhs.exception.MhsConnectionException;
5454
import uk.nhs.adaptors.gp2gp.mhs.exception.MhsServerErrorException;
55-
import uk.nhs.adaptors.gp2gp.ehr.exception.EhrValidationException;
5655
import uk.nhs.adaptors.gp2gp.mhs.model.OutboundMessage;
5756
import uk.nhs.adaptors.gp2gp.testcontainers.ActiveMQExtension;
5857
import uk.nhs.adaptors.gp2gp.testcontainers.MongoDBExtension;
@@ -65,6 +64,7 @@
6564
@ExtendWith({SpringExtension.class, MongoDBExtension.class, ActiveMQExtension.class, MockitoExtension.class})
6665
@SpringBootTest
6766
@DirtiesContext
67+
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
6868
public class SendEhrExtractCoreComponentTest extends BaseTaskTest {
6969
private static final String OUTBOUND_MESSAGE = serializeOutboundMessage("payload");
7070
public static final String OUTBOUND_MESSAGE_WITH_PLACEHOLDER =
@@ -357,7 +357,6 @@ public void When_ExtractCoreThrowsMhsServerErrorException_Expect_ExceptionThrown
357357
assertThat(ehrExtractStatusUpdated.getEhrExtractCore()).isNull();
358358
}
359359

360-
361360
@BeforeEach
362361
public void prepareCommonStubbing() {
363362
when(gp2gpConfiguration.getLargeEhrExtractThreshold()).thenReturn(BinaryUtils.getBytesLengthOfString(SEVENTEEN_BYTE_PAYLOAD) - 1);

0 commit comments

Comments
 (0)