@@ -39,24 +39,24 @@ public class AmendmentAddressToEdifactMapperTest extends AmendmentFhirToEdifactT
3939 @ Override
4040 void setUp () {
4141 super .setUp ();
42- lenient ().when (amendmentBody .getNhsNumber ()).thenReturn (NHS_NUMBER );
42+ lenient ().when (super . getAmendmentBody () .getNhsNumber ()).thenReturn (NHS_NUMBER );
4343 }
4444
4545 @ Test
4646 void When_ReplacingAllFiveAddressLinesFields_Expect_AllAddressLinesAreMapped () {
4747 AmendmentPatchOperation operation = AmendmentPatchOperation .REPLACE ;
48- when (jsonPatches .getHouseName ()).thenReturn (Optional .of (new AmendmentPatch ()
48+ when (super . getJsonPatches () .getHouseName ()).thenReturn (Optional .of (new AmendmentPatch ()
4949 .setOp (operation ).setValue (AmendmentValue .from (HOUSE_NAME ))));
50- when (jsonPatches .getNumberOrRoadName ()).thenReturn (Optional .of (new AmendmentPatch ()
50+ when (super . getJsonPatches () .getNumberOrRoadName ()).thenReturn (Optional .of (new AmendmentPatch ()
5151 .setOp (operation ).setValue (AmendmentValue .from (ROAD_NAME ))));
52- when (jsonPatches .getLocality ()).thenReturn (Optional .of (new AmendmentPatch ()
52+ when (super . getJsonPatches () .getLocality ()).thenReturn (Optional .of (new AmendmentPatch ()
5353 .setOp (operation ).setValue (AmendmentValue .from (LOCALITY ))));
54- when (jsonPatches .getPostTown ()).thenReturn (Optional .of (new AmendmentPatch ()
54+ when (super . getJsonPatches () .getPostTown ()).thenReturn (Optional .of (new AmendmentPatch ()
5555 .setOp (operation ).setValue (AmendmentValue .from (POST_TOWN ))));
56- when (jsonPatches .getCounty ()).thenReturn (Optional .of (new AmendmentPatch ()
56+ when (super . getJsonPatches () .getCounty ()).thenReturn (Optional .of (new AmendmentPatch ()
5757 .setOp (operation ).setValue (AmendmentValue .from (COUNTY ))));
5858
59- Optional <Segment > segments = translator .map (amendmentBody );
59+ Optional <Segment > segments = translator .map (super . getAmendmentBody () );
6060
6161 assertThat (segments ).isNotEmpty ().get ()
6262 .isEqualTo (PersonAddress .builder ()
@@ -71,18 +71,18 @@ void When_ReplacingAllFiveAddressLinesFields_Expect_AllAddressLinesAreMapped() {
7171 @ Test
7272 void When_AddressLineIsnull_Expect_NullToBeMapperAsEmptyEdifactString () {
7373 AmendmentPatchOperation operation = AmendmentPatchOperation .REPLACE ;
74- when (jsonPatches .getHouseName ()).thenReturn (Optional .of (new AmendmentPatch ()
74+ when (super . getJsonPatches () .getHouseName ()).thenReturn (Optional .of (new AmendmentPatch ()
7575 .setOp (operation ).setValue (AmendmentValue .from (HOUSE_NAME ))));
76- when (jsonPatches .getNumberOrRoadName ()).thenReturn (Optional .of (new AmendmentPatch ()
76+ when (super . getJsonPatches () .getNumberOrRoadName ()).thenReturn (Optional .of (new AmendmentPatch ()
7777 .setOp (operation ).setValue (AmendmentValue .from (ROAD_NAME ))));
78- when (jsonPatches .getLocality ()).thenReturn (Optional .of (new AmendmentPatch ()
78+ when (super . getJsonPatches () .getLocality ()).thenReturn (Optional .of (new AmendmentPatch ()
7979 .setOp (operation ).setValue (null )));
80- when (jsonPatches .getPostTown ()).thenReturn (Optional .of (new AmendmentPatch ()
80+ when (super . getJsonPatches () .getPostTown ()).thenReturn (Optional .of (new AmendmentPatch ()
8181 .setOp (operation ).setValue (null )));
82- when (jsonPatches .getCounty ()).thenReturn (Optional .of (new AmendmentPatch ()
82+ when (super . getJsonPatches () .getCounty ()).thenReturn (Optional .of (new AmendmentPatch ()
8383 .setOp (operation ).setValue (null )));
8484
85- Optional <Segment > segments = translator .map (amendmentBody );
85+ Optional <Segment > segments = translator .map (super . getAmendmentBody () );
8686
8787 assertThat (segments ).isNotEmpty ().get ()
8888 .isEqualTo (PersonAddress .builder ()
@@ -97,18 +97,18 @@ void When_AddressLineIsnull_Expect_NullToBeMapperAsEmptyEdifactString() {
9797 @ Test
9898 void When_RemovingFourAddressLinesFields_Expect_FourAddressLinesRemoved () {
9999 AmendmentPatchOperation operation = AmendmentPatchOperation .REMOVE ;
100- when (jsonPatches .getHouseName ()).thenReturn (Optional .of (new AmendmentPatch ()
100+ when (super . getJsonPatches () .getHouseName ()).thenReturn (Optional .of (new AmendmentPatch ()
101101 .setOp (operation ).setValue (AmendmentValue .from (REMOVE_INDICATOR ))));
102- when (jsonPatches .getNumberOrRoadName ()).thenReturn (Optional .of (new AmendmentPatch ()
102+ when (super . getJsonPatches () .getNumberOrRoadName ()).thenReturn (Optional .of (new AmendmentPatch ()
103103 .setOp (operation ).setValue (AmendmentValue .from (REMOVE_INDICATOR ))));
104- when (jsonPatches .getLocality ()).thenReturn (Optional .of (new AmendmentPatch ()
104+ when (super . getJsonPatches () .getLocality ()).thenReturn (Optional .of (new AmendmentPatch ()
105105 .setOp (operation ).setValue (AmendmentValue .from (REMOVE_INDICATOR ))));
106- when (jsonPatches .getPostTown ()).thenReturn (Optional .of (new AmendmentPatch ()
106+ when (super . getJsonPatches () .getPostTown ()).thenReturn (Optional .of (new AmendmentPatch ()
107107 .setOp (AmendmentPatchOperation .REPLACE ).setValue (AmendmentValue .from (POST_TOWN ))));
108- when (jsonPatches .getCounty ()).thenReturn (Optional .of (new AmendmentPatch ()
108+ when (super . getJsonPatches () .getCounty ()).thenReturn (Optional .of (new AmendmentPatch ()
109109 .setOp (operation ).setValue (AmendmentValue .from (REMOVE_INDICATOR ))));
110110
111- Optional <Segment > segments = translator .map (amendmentBody );
111+ Optional <Segment > segments = translator .map (super . getAmendmentBody () );
112112
113113 assertThat (segments ).isNotEmpty ().get ()
114114 .isEqualTo (PersonAddress .builder ()
@@ -123,108 +123,108 @@ void When_RemovingFourAddressLinesFields_Expect_FourAddressLinesRemoved() {
123123 @ Test
124124 void When_HouseNameMissing_Expect_ThrowsFhirValidationException () {
125125 AmendmentPatchOperation operation = AmendmentPatchOperation .REPLACE ;
126- when (jsonPatches .getHouseName ()).thenReturn (Optional .empty ());
127- when (jsonPatches .getNumberOrRoadName ()).thenReturn (Optional .of (new AmendmentPatch ()
126+ when (super . getJsonPatches () .getHouseName ()).thenReturn (Optional .empty ());
127+ when (super . getJsonPatches () .getNumberOrRoadName ()).thenReturn (Optional .of (new AmendmentPatch ()
128128 .setOp (operation ).setValue (AmendmentValue .from (ROAD_NAME ))));
129- when (jsonPatches .getLocality ()).thenReturn (Optional .of (new AmendmentPatch ()
129+ when (super . getJsonPatches () .getLocality ()).thenReturn (Optional .of (new AmendmentPatch ()
130130 .setOp (operation ).setValue (AmendmentValue .from (LOCALITY ))));
131- when (jsonPatches .getPostTown ()).thenReturn (Optional .of (new AmendmentPatch ()
131+ when (super . getJsonPatches () .getPostTown ()).thenReturn (Optional .of (new AmendmentPatch ()
132132 .setOp (operation ).setValue (AmendmentValue .from (POST_TOWN ))));
133- when (jsonPatches .getCounty ()).thenReturn (Optional .of (new AmendmentPatch ()
133+ when (super . getJsonPatches () .getCounty ()).thenReturn (Optional .of (new AmendmentPatch ()
134134 .setOp (operation ).setValue (AmendmentValue .from (COUNTY ))));
135135
136- assertThatThrownBy (() -> translator .map (amendmentBody ))
136+ assertThatThrownBy (() -> translator .map (super . getAmendmentBody () ))
137137 .isExactlyInstanceOf (FhirValidationException .class )
138138 .hasMessage (ALL_FIVE_ADDRESS_LINES_NEEDED_MESSAGE );
139139 }
140140
141141 @ Test
142142 void When_NumberOrRoadNameMissing_Expect_ThrowsFhirValidationException () {
143143 AmendmentPatchOperation operation = AmendmentPatchOperation .REPLACE ;
144- when (jsonPatches .getHouseName ()).thenReturn (Optional .of (new AmendmentPatch ()
144+ when (super . getJsonPatches () .getHouseName ()).thenReturn (Optional .of (new AmendmentPatch ()
145145 .setOp (operation ).setValue (AmendmentValue .from (HOUSE_NAME ))));
146- when (jsonPatches .getNumberOrRoadName ()).thenReturn (Optional .empty ());
147- when (jsonPatches .getLocality ()).thenReturn (Optional .of (new AmendmentPatch ()
146+ when (super . getJsonPatches () .getNumberOrRoadName ()).thenReturn (Optional .empty ());
147+ when (super . getJsonPatches () .getLocality ()).thenReturn (Optional .of (new AmendmentPatch ()
148148 .setOp (operation ).setValue (AmendmentValue .from (LOCALITY ))));
149- when (jsonPatches .getPostTown ()).thenReturn (Optional .of (new AmendmentPatch ()
149+ when (super . getJsonPatches () .getPostTown ()).thenReturn (Optional .of (new AmendmentPatch ()
150150 .setOp (operation ).setValue (AmendmentValue .from (POST_TOWN ))));
151- when (jsonPatches .getCounty ()).thenReturn (Optional .of (new AmendmentPatch ()
151+ when (super . getJsonPatches () .getCounty ()).thenReturn (Optional .of (new AmendmentPatch ()
152152 .setOp (operation ).setValue (AmendmentValue .from (COUNTY ))));
153153
154- assertThatThrownBy (() -> translator .map (amendmentBody ))
154+ assertThatThrownBy (() -> translator .map (super . getAmendmentBody () ))
155155 .isExactlyInstanceOf (FhirValidationException .class )
156156 .hasMessage (ALL_FIVE_ADDRESS_LINES_NEEDED_MESSAGE );
157157 }
158158
159159 @ Test
160160 void When_LocalityMissing_Expect_ThrowsFhirValidationException () {
161161 AmendmentPatchOperation operation = AmendmentPatchOperation .REPLACE ;
162- when (jsonPatches .getHouseName ()).thenReturn (Optional .of (new AmendmentPatch ()
162+ when (super . getJsonPatches () .getHouseName ()).thenReturn (Optional .of (new AmendmentPatch ()
163163 .setOp (operation ).setValue (AmendmentValue .from (HOUSE_NAME ))));
164- when (jsonPatches .getNumberOrRoadName ()).thenReturn (Optional .of (new AmendmentPatch ()
164+ when (super . getJsonPatches () .getNumberOrRoadName ()).thenReturn (Optional .of (new AmendmentPatch ()
165165 .setOp (operation ).setValue (AmendmentValue .from (ROAD_NAME ))));
166- when (jsonPatches .getLocality ()).thenReturn (Optional .empty ());
167- when (jsonPatches .getPostTown ()).thenReturn (Optional .of (new AmendmentPatch ()
166+ when (super . getJsonPatches () .getLocality ()).thenReturn (Optional .empty ());
167+ when (super . getJsonPatches () .getPostTown ()).thenReturn (Optional .of (new AmendmentPatch ()
168168 .setOp (operation ).setValue (AmendmentValue .from (POST_TOWN ))));
169- when (jsonPatches .getCounty ()).thenReturn (Optional .of (new AmendmentPatch ()
169+ when (super . getJsonPatches () .getCounty ()).thenReturn (Optional .of (new AmendmentPatch ()
170170 .setOp (operation ).setValue (AmendmentValue .from (COUNTY ))));
171171
172- assertThatThrownBy (() -> translator .map (amendmentBody ))
172+ assertThatThrownBy (() -> translator .map (super . getAmendmentBody () ))
173173 .isExactlyInstanceOf (FhirValidationException .class )
174174 .hasMessage (ALL_FIVE_ADDRESS_LINES_NEEDED_MESSAGE );
175175 }
176176
177177 @ Test
178178 void When_PostTownMissing_Expect_ThrowsFhirValidationException () {
179179 AmendmentPatchOperation operation = AmendmentPatchOperation .REPLACE ;
180- when (jsonPatches .getHouseName ()).thenReturn (Optional .of (new AmendmentPatch ()
180+ when (super . getJsonPatches () .getHouseName ()).thenReturn (Optional .of (new AmendmentPatch ()
181181 .setOp (operation ).setValue (AmendmentValue .from (HOUSE_NAME ))));
182- when (jsonPatches .getNumberOrRoadName ()).thenReturn (Optional .of (new AmendmentPatch ()
182+ when (super . getJsonPatches () .getNumberOrRoadName ()).thenReturn (Optional .of (new AmendmentPatch ()
183183 .setOp (operation ).setValue (AmendmentValue .from (ROAD_NAME ))));
184- when (jsonPatches .getLocality ()).thenReturn (Optional .of (new AmendmentPatch ()
184+ when (super . getJsonPatches () .getLocality ()).thenReturn (Optional .of (new AmendmentPatch ()
185185 .setOp (operation ).setValue (AmendmentValue .from (LOCALITY ))));
186- when (jsonPatches .getPostTown ()).thenReturn (Optional .empty ());
187- when (jsonPatches .getCounty ()).thenReturn (Optional .of (new AmendmentPatch ()
186+ when (super . getJsonPatches () .getPostTown ()).thenReturn (Optional .empty ());
187+ when (super . getJsonPatches () .getCounty ()).thenReturn (Optional .of (new AmendmentPatch ()
188188 .setOp (operation ).setValue (AmendmentValue .from (COUNTY ))));
189189
190- assertThatThrownBy (() -> translator .map (amendmentBody ))
190+ assertThatThrownBy (() -> translator .map (super . getAmendmentBody () ))
191191 .isExactlyInstanceOf (FhirValidationException .class )
192192 .hasMessage (ALL_FIVE_ADDRESS_LINES_NEEDED_MESSAGE );
193193 }
194194
195195 @ Test
196196 void When_CountyMissing_Expect_ThrowsFhirValidationException () {
197197 AmendmentPatchOperation operation = AmendmentPatchOperation .REPLACE ;
198- when (jsonPatches .getHouseName ()).thenReturn (Optional .of (new AmendmentPatch ()
198+ when (super . getJsonPatches () .getHouseName ()).thenReturn (Optional .of (new AmendmentPatch ()
199199 .setOp (operation ).setValue (AmendmentValue .from (HOUSE_NAME ))));
200- when (jsonPatches .getNumberOrRoadName ()).thenReturn (Optional .of (new AmendmentPatch ()
200+ when (super . getJsonPatches () .getNumberOrRoadName ()).thenReturn (Optional .of (new AmendmentPatch ()
201201 .setOp (operation ).setValue (AmendmentValue .from (ROAD_NAME ))));
202- when (jsonPatches .getLocality ()).thenReturn (Optional .of (new AmendmentPatch ()
202+ when (super . getJsonPatches () .getLocality ()).thenReturn (Optional .of (new AmendmentPatch ()
203203 .setOp (operation ).setValue (AmendmentValue .from (LOCALITY ))));
204- when (jsonPatches .getPostTown ()).thenReturn (Optional .of (new AmendmentPatch ()
204+ when (super . getJsonPatches () .getPostTown ()).thenReturn (Optional .of (new AmendmentPatch ()
205205 .setOp (operation ).setValue (AmendmentValue .from (POST_TOWN ))));
206- when (jsonPatches .getCounty ()).thenReturn (Optional .empty ());
206+ when (super . getJsonPatches () .getCounty ()).thenReturn (Optional .empty ());
207207
208- assertThatThrownBy (() -> translator .map (amendmentBody ))
208+ assertThatThrownBy (() -> translator .map (super . getAmendmentBody () ))
209209 .isExactlyInstanceOf (FhirValidationException .class )
210210 .hasMessage (ALL_FIVE_ADDRESS_LINES_NEEDED_MESSAGE );
211211 }
212212
213213 @ Test
214214 void When_RemoveForPostTown_Expect_ThrowsPatchValidationException () {
215215 AmendmentPatchOperation operation = AmendmentPatchOperation .REMOVE ;
216- when (jsonPatches .getHouseName ()).thenReturn (Optional .of (new AmendmentPatch ()
216+ when (super . getJsonPatches () .getHouseName ()).thenReturn (Optional .of (new AmendmentPatch ()
217217 .setOp (operation ).setValue (AmendmentValue .from (HOUSE_NAME ))));
218- when (jsonPatches .getNumberOrRoadName ()).thenReturn (Optional .of (new AmendmentPatch ()
218+ when (super . getJsonPatches () .getNumberOrRoadName ()).thenReturn (Optional .of (new AmendmentPatch ()
219219 .setOp (operation ).setValue (AmendmentValue .from (ROAD_NAME ))));
220- when (jsonPatches .getLocality ()).thenReturn (Optional .of (new AmendmentPatch ()
220+ when (super . getJsonPatches () .getLocality ()).thenReturn (Optional .of (new AmendmentPatch ()
221221 .setOp (operation ).setValue (AmendmentValue .from (LOCALITY ))));
222- when (jsonPatches .getPostTown ()).thenReturn (Optional .of (new AmendmentPatch ()
222+ when (super . getJsonPatches () .getPostTown ()).thenReturn (Optional .of (new AmendmentPatch ()
223223 .setOp (operation ).setValue (AmendmentValue .from (POST_TOWN ))));
224- when (jsonPatches .getCounty ()).thenReturn (Optional .of (new AmendmentPatch ()
224+ when (super . getJsonPatches () .getCounty ()).thenReturn (Optional .of (new AmendmentPatch ()
225225 .setOp (operation ).setValue (AmendmentValue .from (COUNTY ))));
226226
227- assertThatThrownBy (() -> translator .map (amendmentBody ))
227+ assertThatThrownBy (() -> translator .map (super . getAmendmentBody () ))
228228 .isExactlyInstanceOf (PatchValidationException .class )
229229 .hasMessage ("Post town ('address/0/line/3') cannot be removed" );
230230 }
0 commit comments