File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
main/java/uk/nhs/adaptors/gp2gp/common/service
test/java/uk/nhs/adaptors/gp2gp/common/service Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,6 @@ public String encodeToJson(IBaseResource resource) {
2626
2727 private IParser prepareParser () {
2828 FhirContext ctx = FhirContext .forDstu3 ();
29- ctx .newJsonParser ();
3029 ctx .setParserErrorHandler (new StrictErrorHandler ());
3130 return ctx .newJsonParser ();
3231 }
Original file line number Diff line number Diff line change @@ -44,6 +44,34 @@ void setUp() {
4444 fhirParseService = new FhirParseService ();
4545 }
4646
47+ @ Test
48+ void shouldThrowValidationExceptionForInvalidJsonDiagnosticsField () {
49+
50+ String invalidJson = """
51+ {
52+ "resourceType": "OperationOutcome",
53+ "meta": {
54+ "profile": ["https://fhir.nhs.uk/STU3/StructureDefinition/GPConnect-OperationOutcome-1"]
55+ },
56+ "issue": [ {
57+ "severity": "error",
58+ "code": "value",
59+ "details": {
60+ "coding": [ {
61+ "system": "http://fhir.nhs.net/ValueSet/gpconnect-error-or-warning-code-1",
62+ "code": "INVALID_IDENTIFIER_VALUE"
63+ } ]
64+ },
65+ "diagnosticos": "Provide a conversationId that exists and retry the operation"
66+ } ]
67+ }
68+ """ ;
69+
70+ assertThrows (FhirValidationException .class , () -> {
71+ fhirParseService .parseResource (invalidJson , OperationOutcome .class );
72+ });
73+ }
74+
4775 @ Test
4876 void ableToEncodeOperationOutcomeToJson () throws JsonProcessingException {
4977
You can’t perform that action at this time.
0 commit comments