Skip to content

Commit

Permalink
Replace invalid ValueSet with valid value
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianclay committed Nov 26, 2024
1 parent fbc1f17 commit 27457f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
public class EhrResendController {

private static final String OPERATION_OUTCOME_URL = "https://fhir.nhs.uk/STU3/StructureDefinition/GPConnect-OperationOutcome-1";
private static final String CONFLICT = "CONFLICT";
private static final String PRECONDITION_FAILED = "PRECONDITION_FAILED";
private static final String INVALID_IDENTIFIER_VALUE = "INVALID_IDENTIFIER_VALUE";

private EhrExtractStatusRepository ehrExtractStatusRepository;
Expand Down Expand Up @@ -58,7 +58,7 @@ public ResponseEntity<String> scheduleEhrExtractResend(@PathVariable String conv

if (hasNoErrorsInEhrReceivedAcknowledgement(ehrExtractStatus) && ehrExtractStatus.getError() == null) {

var details = getCodeableConcept(CONFLICT);
var details = getCodeableConcept(PRECONDITION_FAILED);
var diagnostics = "The current resend operation is still in progress. Please wait for it to complete before retrying";
var operationOutcome = createOperationOutcome(OperationOutcome.IssueType.BUSINESSRULE,
OperationOutcome.IssueSeverity.ERROR,
Expand All @@ -78,7 +78,7 @@ public ResponseEntity<String> scheduleEhrExtractResend(@PathVariable String conv

private static CodeableConcept getCodeableConcept(String codeableConceptCode) {
return new CodeableConcept().addCoding(
new Coding("http://fhir.nhs.net/ValueSet/gpconnect-error-or-warning-code-1", codeableConceptCode, null));
new Coding("https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1", codeableConceptCode, null));
}

private static boolean hasNoErrorsInEhrReceivedAcknowledgement(EhrExtractStatus ehrExtractStatus) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class EhrResendControllerTest {
private static final String FROM_ASID_CODE = "test-from-asid";
private static final String INCUMBENT_NACK_CODE = "99";
private static final String INCUMBENT_NACK_DISPLAY = "Unexpected condition.";
private static final String CONFLICT = "CONFLICT";
private static final String GPCONNECT_ERROR_OR_WARNING_CODE = "http://fhir.nhs.net/ValueSet/gpconnect-error-or-warning-code-1";
private static final String PRECONDITION_FAILED = "PRECONDITION_FAILED";
private static final String GPCONNECT_ERROR_OR_WARNING_CODE = "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1";
private static final String INVALID_IDENTIFIER_VALUE = "INVALID_IDENTIFIER_VALUE";
public static final String ISSUE_CODE_VALUE = "value";
public static final String ISSUE_CODE_BUSINESS_RULE = "business-rule";
Expand Down Expand Up @@ -129,7 +129,7 @@ void When_AnEhrExtractHasFailed_Expect_GetGpcStructuredTaskScheduledAndEhrExtrac
}

@Test
void When_AnEhrExtractHasNotFailedAndAnotherResendRequestArrives_Expect_FailedOperationOutcome() throws JsonProcessingException {
void When_AnEhrExtractIsStillInProgress_Expect_FailedOperationOutcome() throws JsonProcessingException {

final EhrExtractStatus IN_PROGRESS_EXTRACT_STATUS = EhrExtractStatus.builder()
.conversationId(CONVERSATION_ID)
Expand All @@ -145,7 +145,7 @@ void When_AnEhrExtractHasNotFailedAndAnotherResendRequestArrives_Expect_FailedOp
JsonNode rootNode = objectMapper.readTree(response.getBody());

assertAll(
() -> assertResponseHasExpectedOperationOutcome(rootNode, CONFLICT, DIAGNOSTICS_MSG, ISSUE_CODE_BUSINESS_RULE),
() -> assertResponseHasExpectedOperationOutcome(rootNode, PRECONDITION_FAILED, DIAGNOSTICS_MSG, ISSUE_CODE_BUSINESS_RULE),
() -> assertEquals(HttpStatus.CONFLICT, response.getStatusCode())
);
}
Expand Down Expand Up @@ -181,7 +181,7 @@ void When_AnEhrExtractHasFailed_Expect_RespondsWith202() {
}

@Test
void When_AnEhrExtractHasNotFailed_Expect_RespondsWith403() throws JsonProcessingException {
void When_AnEhrExtractHasAPositiveAcknowledgement_Expect_FailedOperationOutcome() throws JsonProcessingException {

String ehrMessageRef = generateRandomUppercaseUUID();
var ehrExtractStatus = new EhrExtractStatus();
Expand All @@ -202,7 +202,7 @@ void When_AnEhrExtractHasNotFailed_Expect_RespondsWith403() throws JsonProcessin
JsonNode rootNode = objectMapper.readTree(response.getBody());

assertAll(
() -> assertResponseHasExpectedOperationOutcome(rootNode, CONFLICT, DIAGNOSTICS_MSG, ISSUE_CODE_BUSINESS_RULE),
() -> assertResponseHasExpectedOperationOutcome(rootNode, PRECONDITION_FAILED, DIAGNOSTICS_MSG, ISSUE_CODE_BUSINESS_RULE),
() -> assertEquals(HttpStatus.CONFLICT, response.getStatusCode())
);
}
Expand Down

0 comments on commit 27457f5

Please sign in to comment.