File tree Expand file tree Collapse file tree 2 files changed +95
-0
lines changed
java/uk/nhs/adaptors/gp2gp/ehr/mapper
resources/ehr/mapper/encounter Expand file tree Collapse file tree 2 files changed +95
-0
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,22 @@ public void When_MappingEncounterWithNoType_Expect_Exception() {
173173 .hasMessage ("Could not map Encounter type" );
174174 }
175175
176+ @ Test
177+ public void When_MappingEncounterLocationWithNoReference_Expect_Exception () {
178+ lenient ().when (randomIdGeneratorService .createNewId ()).thenReturn (TEST_ID );
179+ lenient ().when (bundle .getEntry ()).thenReturn (List .of (BUNDLE_ENTRY_WITH_CONSULTATION ));
180+ var sampleComponent = ResourceTestFileUtils .getFileContent (SAMPLE_EHR_COMPOSITION_COMPONENT );
181+
182+ var jsonInput = ResourceTestFileUtils .getFileContent (TEST_FILES_DIRECTORY
183+ + "input-encounter-with-location-with-no-reference.json" );
184+ Encounter parsedEncounter = new FhirParseService ().parseResource (jsonInput , Encounter .class );
185+ when (encounterComponentsMapper .mapComponents (parsedEncounter )).thenReturn (sampleComponent );
186+
187+ assertThatThrownBy (() -> encounterMapper .mapEncounterToEhrComposition (parsedEncounter ))
188+ .isExactlyInstanceOf (EhrMapperException .class )
189+ .hasMessage ("Resource not found: Location/EB3994A6-5A87-4B53-A414-913137072F57" );
190+ }
191+
176192 @ Test
177193 public void When_MappingEncounterWithInvalidParticipantReferenceResourceType_Expect_Exception () {
178194 var sampleComponent = ResourceTestFileUtils .getFileContent (SAMPLE_EHR_COMPOSITION_COMPONENT );
Original file line number Diff line number Diff line change 1+ {
2+ "resourceType" :" Encounter" ,
3+ "id" :" F550CC56-EF65-4934-A7B1-3DC2E02243C3" ,
4+ "meta" :{
5+ "profile" :[
6+ " https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Encounter-1"
7+ ]
8+ },
9+ "identifier" :[
10+ {
11+ "system" :" https://EMISWeb/A82038" ,
12+ "value" :" F550CC56-EF65-4934-A7B1-3DC2E02243C3"
13+ }
14+ ],
15+ "status" :" finished" ,
16+ "type" :[
17+ {
18+ "text" :" GP Surgery" ,
19+ "coding" : [
20+ {
21+ "system" :" http://snomed.info/sct" ,
22+ "code" :" 24561000000109" ,
23+ "display" :" A+E report"
24+ }
25+ ]
26+ }
27+ ],
28+ "subject" :{
29+ "reference" :" Patient/88F14BF6-CADE-47D6-90E2-B10519BF956F"
30+ },
31+ "participant" :[
32+ {
33+ "type" :[
34+ {
35+ "coding" :[
36+ {
37+ "system" :" http://hl7.org/fhir/v3/ParticipationType" ,
38+ "code" :" PPRF" ,
39+ "display" :" primary performer"
40+ }
41+ ]
42+ }
43+ ],
44+ "individual" :{
45+ "reference" :" Practitioner/6D340A1B-BC15-4D4E-93CF-BBCB5B74DF73"
46+ }
47+ },
48+ {
49+ "type" :[
50+ {
51+ "coding" :[
52+ {
53+ "system" :" https://fhir.nhs.uk/STU3/CodeSystem/GPConnect-ParticipantType-1" ,
54+ "code" :" REC" ,
55+ "display" :" recorder"
56+ }
57+ ]
58+ }
59+ ],
60+ "individual" :{
61+ "reference" :" Practitioner/6D340A1B-BC15-4D4E-93CF-BBCB5B74DF73"
62+ }
63+ }
64+ ],
65+ "period" :{
66+ "start" :" 2010-01-13T15:20:00+00:00" ,
67+ "end" :" 2010-01-13T16:20:00+00:00"
68+ },
69+ "location" :[
70+ {
71+ "location" :{
72+ "reference" :" Location/EB3994A6-5A87-4B53-A414-913137072F57"
73+ }
74+ }
75+ ],
76+ "serviceProvider" :{
77+ "reference" :" Organization/5E496953-065B-41F2-9577-BE8F2FBD0757"
78+ }
79+ }
You can’t perform that action at this time.
0 commit comments