1 | /*
|
---|
2 | * To change this template, choose Tools | Templates
|
---|
3 | * and open the template in the editor.
|
---|
4 | */
|
---|
5 | package gov.hhs.fha.nhinc.transform.subdisc;
|
---|
6 |
|
---|
7 | import gov.hhs.fha.nhinc.nhinclib.NullChecker;
|
---|
8 | import java.io.Serializable;
|
---|
9 | import java.util.Iterator;
|
---|
10 | import java.util.List;
|
---|
11 | import javax.xml.bind.JAXBElement;
|
---|
12 | import org.hl7.v3.ENExplicit;
|
---|
13 | import org.hl7.v3.EnExplicitFamily;
|
---|
14 | import org.hl7.v3.EnExplicitGiven;
|
---|
15 | import org.apache.commons.logging.Log;
|
---|
16 | import org.apache.commons.logging.LogFactory;
|
---|
17 | import org.hl7.v3.MCCIMT000100UV01Receiver;
|
---|
18 | import org.hl7.v3.MCCIMT000100UV01Sender;
|
---|
19 | import org.hl7.v3.MCCIMT000200UV01Receiver;
|
---|
20 | import org.hl7.v3.MCCIMT000200UV01Sender;
|
---|
21 | import org.hl7.v3.MCCIMT000300UV01Receiver;
|
---|
22 | import org.hl7.v3.MCCIMT000300UV01Sender;
|
---|
23 | import org.hl7.v3.PNExplicit;
|
---|
24 | import org.hl7.v3.PRPAIN201301UV;
|
---|
25 | import org.hl7.v3.PRPAIN201301UVMFMIMT700701UV01ControlActProcess;
|
---|
26 | import org.hl7.v3.PRPAIN201302UV;
|
---|
27 | import org.hl7.v3.PRPAIN201302UVMFMIMT700701UV01ControlActProcess;
|
---|
28 | import org.hl7.v3.PRPAIN201305UV;
|
---|
29 | import org.hl7.v3.PRPAIN201305UVQUQIMT021001UV01ControlActProcess;
|
---|
30 | import org.hl7.v3.PRPAIN201310UV;
|
---|
31 | import org.hl7.v3.PRPAMT201307UVQueryByParameter;
|
---|
32 | import static org.junit.Assert.*;
|
---|
33 |
|
---|
34 | /**
|
---|
35 | *
|
---|
36 | * @author Jon Hoppesch
|
---|
37 | */
|
---|
38 | public class TestHelper {
|
---|
39 |
|
---|
40 | private static Log log = LogFactory.getLog(TestHelper.class);
|
---|
41 |
|
---|
42 | public static void assertENNameEquals(ENExplicit enName, String family, String given) {
|
---|
43 | List<Serializable> choice = enName.getContent();
|
---|
44 | Iterator<Serializable> iterSerialObjects = choice.iterator();
|
---|
45 |
|
---|
46 | assertNameEquals(iterSerialObjects, family, given);
|
---|
47 | }
|
---|
48 |
|
---|
49 | public static void assertPNNameEquals(PNExplicit pnName, String family, String given) {
|
---|
50 | List<Serializable> choice = pnName.getContent();
|
---|
51 | Iterator<Serializable> iterSerialObjects = choice.iterator();
|
---|
52 |
|
---|
53 | assertNameEquals(iterSerialObjects, family, given);
|
---|
54 | }
|
---|
55 |
|
---|
56 | public static void assertNameEquals(Iterator<Serializable> iterSerialObjects, String family, String given) {
|
---|
57 | EnExplicitFamily enFamilyName = null;
|
---|
58 | EnExplicitGiven enGivenName = new EnExplicitGiven();
|
---|
59 |
|
---|
60 | while (iterSerialObjects.hasNext()) {
|
---|
61 | Serializable contentItem = iterSerialObjects.next();
|
---|
62 |
|
---|
63 | if (contentItem instanceof JAXBElement) {
|
---|
64 | JAXBElement oJAXBElement = (JAXBElement) contentItem;
|
---|
65 |
|
---|
66 | if (oJAXBElement.getValue() instanceof EnExplicitFamily) {
|
---|
67 | enFamilyName = (EnExplicitFamily) oJAXBElement.getValue();
|
---|
68 | log.info("Family Name: " + enFamilyName.getContent());
|
---|
69 | } else if (oJAXBElement.getValue() instanceof EnExplicitGiven) {
|
---|
70 | enGivenName = (EnExplicitGiven) oJAXBElement.getValue();
|
---|
71 | log.info("Given Name: " + enGivenName.getContent());
|
---|
72 | }
|
---|
73 | }
|
---|
74 | }
|
---|
75 |
|
---|
76 | if (NullChecker.isNotNullish(family)) {
|
---|
77 | assertEquals(family, enFamilyName.getContent());
|
---|
78 | }
|
---|
79 |
|
---|
80 | if (NullChecker.isNotNullish(given)) {
|
---|
81 | assertEquals(given, enGivenName.getContent());
|
---|
82 | }
|
---|
83 | }
|
---|
84 |
|
---|
85 | public static void assertNameEquals(Iterator<Serializable> iterSerialObjects, EnExplicitFamily family, EnExplicitGiven given) {
|
---|
86 | EnExplicitFamily enFamilyName = null;
|
---|
87 | EnExplicitGiven enGivenName = new EnExplicitGiven();
|
---|
88 |
|
---|
89 | while (iterSerialObjects.hasNext()) {
|
---|
90 | Serializable contentItem = iterSerialObjects.next();
|
---|
91 |
|
---|
92 | if (contentItem instanceof JAXBElement) {
|
---|
93 | JAXBElement oJAXBElement = (JAXBElement) contentItem;
|
---|
94 |
|
---|
95 | if (oJAXBElement.getValue() instanceof EnExplicitFamily) {
|
---|
96 | enFamilyName = (EnExplicitFamily) oJAXBElement.getValue();
|
---|
97 | log.info("Family Name: " + enFamilyName.getContent());
|
---|
98 | } else if (oJAXBElement.getValue() instanceof EnExplicitGiven) {
|
---|
99 | enGivenName = (EnExplicitGiven) oJAXBElement.getValue();
|
---|
100 | log.info("Given Name: " + enGivenName.getContent());
|
---|
101 | }
|
---|
102 | }
|
---|
103 | }
|
---|
104 |
|
---|
105 | if (family != null) {
|
---|
106 | assertEquals(family.getContent(), enFamilyName.getContent());
|
---|
107 | }
|
---|
108 |
|
---|
109 | if (given != null) {
|
---|
110 | assertEquals(given.getContent(), enGivenName.getContent());
|
---|
111 | }
|
---|
112 | }
|
---|
113 |
|
---|
114 | public static void assertReceiverIdEquals(String receiverOID, PRPAIN201301UV message) {
|
---|
115 | assertNotNull(message.getReceiver());
|
---|
116 | assertNotNull(message.getReceiver().get(0));
|
---|
117 | assertRecDeviceNotNull(message.getReceiver().get(0));
|
---|
118 |
|
---|
119 | if (receiverOID != null && !receiverOID.isEmpty()) {
|
---|
120 | assertEquals(receiverOID, message.getReceiver().get(0).getDevice().getId().get(0).getRoot());
|
---|
121 | }
|
---|
122 | }
|
---|
123 |
|
---|
124 | public static void assertReceiverIdEquals(String receiverOID, PRPAIN201302UV message) {
|
---|
125 | assertNotNull(message.getReceiver());
|
---|
126 | assertNotNull(message.getReceiver().get(0));
|
---|
127 | assertRecDeviceNotNull(message.getReceiver().get(0));
|
---|
128 |
|
---|
129 | if (receiverOID != null && !receiverOID.isEmpty()) {
|
---|
130 | assertEquals(receiverOID, message.getReceiver().get(0).getDevice().getId().get(0).getRoot());
|
---|
131 | }
|
---|
132 | }
|
---|
133 |
|
---|
134 | public static void assertReceiverIdEquals(String receiverOID, PRPAIN201305UV message) {
|
---|
135 | assertNotNull(message.getReceiver());
|
---|
136 | assertNotNull(message.getReceiver().get(0));
|
---|
137 | assertRecDeviceNotNull(message.getReceiver().get(0));
|
---|
138 |
|
---|
139 | if (receiverOID != null && !receiverOID.isEmpty()) {
|
---|
140 | assertEquals(receiverOID, message.getReceiver().get(0).getDevice().getId().get(0).getRoot());
|
---|
141 | }
|
---|
142 | }
|
---|
143 |
|
---|
144 | static void assertReceiverIdEquals(String receiverOID, PRPAIN201310UV message) {
|
---|
145 | assertNotNull(message.getReceiver());
|
---|
146 | assertNotNull(message.getReceiver().get(0));
|
---|
147 | assertRecDeviceNotNull(message.getReceiver().get(0));
|
---|
148 |
|
---|
149 | if (receiverOID != null && !receiverOID.isEmpty()) {
|
---|
150 | assertEquals(receiverOID, message.getReceiver().get(0).getDevice().getId().get(0).getRoot());
|
---|
151 | }
|
---|
152 | }
|
---|
153 |
|
---|
154 | public static void assertRecDeviceNotNull(MCCIMT000100UV01Receiver receiver) {
|
---|
155 | assertNotNull(receiver.getDevice());
|
---|
156 | assertNotNull(receiver.getDevice().getId());
|
---|
157 | assertNotNull(receiver.getDevice().getId().get(0));
|
---|
158 | }
|
---|
159 |
|
---|
160 | public static void assertRecDeviceNotNull(MCCIMT000200UV01Receiver receiver) {
|
---|
161 | assertNotNull(receiver.getDevice());
|
---|
162 | assertNotNull(receiver.getDevice().getId());
|
---|
163 | assertNotNull(receiver.getDevice().getId().get(0));
|
---|
164 | }
|
---|
165 |
|
---|
166 | private static void assertRecDeviceNotNull(MCCIMT000300UV01Receiver receiver) {
|
---|
167 | assertNotNull(receiver.getDevice());
|
---|
168 | assertNotNull(receiver.getDevice().getId());
|
---|
169 | assertNotNull(receiver.getDevice().getId().get(0));
|
---|
170 | }
|
---|
171 |
|
---|
172 | public static void assertSenderIdEquals(String senderOID, PRPAIN201301UV message) {
|
---|
173 | assertNotNull(message.getSender());
|
---|
174 | assertSendDeviceNotNull(message.getSender());
|
---|
175 |
|
---|
176 | if (senderOID != null && !senderOID.isEmpty()) {
|
---|
177 | assertEquals(senderOID, message.getSender().getDevice().getId().get(0).getRoot());
|
---|
178 | }
|
---|
179 | }
|
---|
180 |
|
---|
181 | public static void assertSenderIdEquals(String senderOID, PRPAIN201302UV message) {
|
---|
182 | assertNotNull(message.getSender());
|
---|
183 | assertSendDeviceNotNull(message.getSender());
|
---|
184 |
|
---|
185 | if (senderOID != null && !senderOID.isEmpty()) {
|
---|
186 | assertEquals(senderOID, message.getSender().getDevice().getId().get(0).getRoot());
|
---|
187 | }
|
---|
188 | }
|
---|
189 |
|
---|
190 | public static void assertSenderIdEquals(String senderOID, PRPAIN201305UV message) {
|
---|
191 | assertNotNull(message.getSender());
|
---|
192 | assertSendDeviceNotNull(message.getSender());
|
---|
193 |
|
---|
194 | if (senderOID != null && !senderOID.isEmpty()) {
|
---|
195 | assertEquals(senderOID, message.getSender().getDevice().getId().get(0).getRoot());
|
---|
196 | }
|
---|
197 | }
|
---|
198 |
|
---|
199 | static void assertSenderIdEquals(String senderOID, PRPAIN201310UV message) {
|
---|
200 | assertNotNull(message.getSender());
|
---|
201 | assertSendDeviceNotNull(message.getSender());
|
---|
202 |
|
---|
203 | if (senderOID != null && !senderOID.isEmpty()) {
|
---|
204 | assertEquals(senderOID, message.getSender().getDevice().getId().get(0).getRoot());
|
---|
205 | }
|
---|
206 | }
|
---|
207 |
|
---|
208 | public static void assertSendDeviceNotNull(MCCIMT000100UV01Sender sender) {
|
---|
209 | assertNotNull(sender.getDevice());
|
---|
210 | assertNotNull(sender.getDevice().getId());
|
---|
211 | assertNotNull(sender.getDevice().getId().get(0));
|
---|
212 | }
|
---|
213 |
|
---|
214 | public static void assertSendDeviceNotNull(MCCIMT000200UV01Sender sender) {
|
---|
215 | assertNotNull(sender.getDevice());
|
---|
216 | assertNotNull(sender.getDevice().getId());
|
---|
217 | assertNotNull(sender.getDevice().getId().get(0));
|
---|
218 | }
|
---|
219 |
|
---|
220 | private static void assertSendDeviceNotNull(MCCIMT000300UV01Sender sender) {
|
---|
221 | assertNotNull(sender.getDevice());
|
---|
222 | assertNotNull(sender.getDevice().getId());
|
---|
223 | assertNotNull(sender.getDevice().getId().get(0));
|
---|
224 | }
|
---|
225 |
|
---|
226 | public static void assertPatientIdEquals(String patId, String localDeviceId, PRPAIN201301UV message) {
|
---|
227 | assertNotNull(message.getControlActProcess());
|
---|
228 | assertPatientNotNull(message.getControlActProcess());
|
---|
229 |
|
---|
230 | if (localDeviceId != null && !localDeviceId.isEmpty()) {
|
---|
231 | assertEquals(localDeviceId, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getId().get(0).getRoot());
|
---|
232 | }
|
---|
233 | if (patId != null && !patId.isEmpty()) {
|
---|
234 | assertEquals(patId, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getId().get(0).getExtension());
|
---|
235 | }
|
---|
236 | }
|
---|
237 |
|
---|
238 | public static void assertPatientIdEquals(String patId, String localDeviceId, PRPAIN201302UV message) {
|
---|
239 | assertNotNull(message.getControlActProcess());
|
---|
240 | assertPatientNotNull(message.getControlActProcess());
|
---|
241 |
|
---|
242 | if (localDeviceId != null && !localDeviceId.isEmpty()) {
|
---|
243 | assertEquals(localDeviceId, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getId().get(0).getRoot());
|
---|
244 | }
|
---|
245 | if (patId != null && !patId.isEmpty()) {
|
---|
246 | assertEquals(patId, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getId().get(0).getExtension());
|
---|
247 | }
|
---|
248 | }
|
---|
249 |
|
---|
250 | public static void assertPatientIdEquals(String patId, String localDeviceId, PRPAIN201305UV message) {
|
---|
251 | assertNotNull(message.getControlActProcess());
|
---|
252 | assertParamListNotNull(message.getControlActProcess());
|
---|
253 |
|
---|
254 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectId());
|
---|
255 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectId().get(0));
|
---|
256 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectId().get(0).getValue());
|
---|
257 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectId().get(0).getValue().get(0));
|
---|
258 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectId().get(0).getValue().get(0).getRoot());
|
---|
259 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectId().get(0).getValue().get(0).getExtension());
|
---|
260 |
|
---|
261 | if (localDeviceId != null && !localDeviceId.isEmpty()) {
|
---|
262 | assertEquals(localDeviceId, message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectId().get(0).getValue().get(0).getRoot());
|
---|
263 | }
|
---|
264 | if (patId != null && !patId.isEmpty()) {
|
---|
265 | assertEquals(patId, message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectId().get(0).getValue().get(0).getExtension());
|
---|
266 | }
|
---|
267 | }
|
---|
268 |
|
---|
269 | static void assertPatientIdEquals(String patientId, String assigningAuthorityId, String localDeviceId, PRPAIN201310UV message) {
|
---|
270 | assertNotNull(message.getControlActProcess());
|
---|
271 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getCustodian().getAssignedEntity().getId().get(0));
|
---|
272 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getId().get(0));
|
---|
273 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getId().get(0));
|
---|
274 |
|
---|
275 | if (localDeviceId != null && !localDeviceId.isEmpty()) {
|
---|
276 | assertEquals(localDeviceId, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getCustodian().getAssignedEntity().getId().get(0).getRoot());
|
---|
277 | }
|
---|
278 | if (assigningAuthorityId != null && !assigningAuthorityId.isEmpty()) {
|
---|
279 | assertEquals(assigningAuthorityId, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getId().get(0).getRoot());
|
---|
280 | }
|
---|
281 | if (patientId != null && !patientId.isEmpty()) {
|
---|
282 | assertEquals(patientId, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getId().get(0).getExtension());
|
---|
283 | }
|
---|
284 | }
|
---|
285 |
|
---|
286 | public static void assertSsnEquals(String ssn, PRPAIN201301UV message) {
|
---|
287 | assertNotNull(message.getControlActProcess());
|
---|
288 | assertPatientPersonNotNull(message.getControlActProcess());
|
---|
289 |
|
---|
290 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs());
|
---|
291 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs().get(0));
|
---|
292 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs().get(0).getId());
|
---|
293 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs().get(0).getId().get(0));
|
---|
294 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs().get(0).getId().get(0).getRoot());
|
---|
295 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs().get(0).getId().get(0).getExtension());
|
---|
296 |
|
---|
297 | assertEquals(HL7Constants.SSN_ID_ROOT, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs().get(0).getId().get(0).getRoot());
|
---|
298 | if (ssn != null && !ssn.isEmpty()) {
|
---|
299 | assertEquals(ssn, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs().get(0).getId().get(0).getExtension());
|
---|
300 | }
|
---|
301 | }
|
---|
302 |
|
---|
303 | public static void assertSsnEquals(String ssn, PRPAIN201302UV message) {
|
---|
304 | assertNotNull(message.getControlActProcess());
|
---|
305 | assertPatientPersonNotNull(message.getControlActProcess());
|
---|
306 |
|
---|
307 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs());
|
---|
308 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs().get(0));
|
---|
309 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs().get(0).getId());
|
---|
310 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs().get(0).getId().get(0));
|
---|
311 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs().get(0).getId().get(0).getRoot());
|
---|
312 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs().get(0).getId().get(0).getExtension());
|
---|
313 |
|
---|
314 | assertEquals(HL7Constants.SSN_ID_ROOT, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs().get(0).getId().get(0).getRoot());
|
---|
315 | if (ssn != null && !ssn.isEmpty()) {
|
---|
316 | assertEquals(ssn, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs().get(0).getId().get(0).getExtension());
|
---|
317 | }
|
---|
318 | }
|
---|
319 |
|
---|
320 | public static void assertSsnNull(PRPAIN201301UV message) {
|
---|
321 | assertNotNull(message.getControlActProcess());
|
---|
322 | assertPatientPersonNotNull(message.getControlActProcess());
|
---|
323 |
|
---|
324 | assertEquals(0, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs().size());
|
---|
325 | }
|
---|
326 |
|
---|
327 | public static void assertSsnNull(PRPAIN201302UV message) {
|
---|
328 | assertNotNull(message.getControlActProcess());
|
---|
329 | assertPatientPersonNotNull(message.getControlActProcess());
|
---|
330 |
|
---|
331 | assertEquals(1, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs().size());
|
---|
332 | assertEquals(1, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs().get(0).getId().size());
|
---|
333 | assertNotSame(HL7Constants.SSN_ID_ROOT, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAsOtherIDs().get(0).getId().get(0).getRoot());
|
---|
334 | }
|
---|
335 |
|
---|
336 | public static void assertPatientNameEquals(String firstName, String lastName, PRPAIN201301UV message) {
|
---|
337 | assertNotNull(message.getControlActProcess());
|
---|
338 | assertPatientPersonNotNull(message.getControlActProcess());
|
---|
339 |
|
---|
340 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getName());
|
---|
341 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getName().get(0));
|
---|
342 |
|
---|
343 | PNExplicit pnName = message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getName().get(0);
|
---|
344 | List<Serializable> choice = pnName.getContent();
|
---|
345 | Iterator<Serializable> iterSerialObjects = choice.iterator();
|
---|
346 |
|
---|
347 | assertNameEquals(iterSerialObjects, lastName, firstName);
|
---|
348 | }
|
---|
349 |
|
---|
350 | public static void assertPatientNameEquals(String firstName, String lastName, PRPAIN201302UV message) {
|
---|
351 | assertNotNull(message.getControlActProcess());
|
---|
352 | assertPatientPersonNotNull(message.getControlActProcess());
|
---|
353 |
|
---|
354 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getName());
|
---|
355 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getName().get(0));
|
---|
356 |
|
---|
357 | PNExplicit pnName = message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getName().get(0);
|
---|
358 | List<Serializable> choice = pnName.getContent();
|
---|
359 | Iterator<Serializable> iterSerialObjects = choice.iterator();
|
---|
360 |
|
---|
361 | assertNameEquals(iterSerialObjects, lastName, firstName);
|
---|
362 | }
|
---|
363 |
|
---|
364 | public static void assertPatientNameEquals(String firstName, String lastName, PRPAIN201305UV message) {
|
---|
365 | assertNotNull(message.getControlActProcess());
|
---|
366 | assertParamListNotNull(message.getControlActProcess());
|
---|
367 |
|
---|
368 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectName());
|
---|
369 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectName().get(0));
|
---|
370 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectName().get(0).getValue());
|
---|
371 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectName().get(0).getValue().get(0));
|
---|
372 |
|
---|
373 | ENExplicit enName = message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectName().get(0).getValue().get(0);
|
---|
374 | List<Serializable> choice = enName.getContent();
|
---|
375 | Iterator<Serializable> iterSerialObjects = choice.iterator();
|
---|
376 |
|
---|
377 | assertNameEquals(iterSerialObjects, lastName, firstName);
|
---|
378 | }
|
---|
379 |
|
---|
380 | public static void assertPatientNameNull(PRPAIN201301UV message) {
|
---|
381 | assertNotNull(message.getControlActProcess());
|
---|
382 | assertPatientPersonNotNull(message.getControlActProcess());
|
---|
383 |
|
---|
384 | assertNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getName());
|
---|
385 | }
|
---|
386 |
|
---|
387 | public static void assertPatientNameNull(PRPAIN201302UV message) {
|
---|
388 | assertNotNull(message.getControlActProcess());
|
---|
389 | assertPatientPersonNotNull(message.getControlActProcess());
|
---|
390 |
|
---|
391 | assertNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getName());
|
---|
392 | }
|
---|
393 |
|
---|
394 | public static void assertPatientNameNull(PRPAIN201305UV message) {
|
---|
395 | assertNotNull(message.getControlActProcess());
|
---|
396 | assertParamListNotNull(message.getControlActProcess());
|
---|
397 |
|
---|
398 | assertNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectName());
|
---|
399 | }
|
---|
400 |
|
---|
401 | public static void assertGenderEquals(String gender, PRPAIN201301UV message) {
|
---|
402 | assertNotNull(message.getControlActProcess());
|
---|
403 | assertPatientPersonNotNull(message.getControlActProcess());
|
---|
404 |
|
---|
405 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAdministrativeGenderCode());
|
---|
406 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAdministrativeGenderCode().getCode());
|
---|
407 | assertEquals(gender, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAdministrativeGenderCode().getCode());
|
---|
408 | }
|
---|
409 |
|
---|
410 | public static void assertGenderEquals(String gender, PRPAIN201302UV message) {
|
---|
411 | assertNotNull(message.getControlActProcess());
|
---|
412 | assertPatientPersonNotNull(message.getControlActProcess());
|
---|
413 |
|
---|
414 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAdministrativeGenderCode());
|
---|
415 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAdministrativeGenderCode().getCode());
|
---|
416 | assertEquals(gender, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAdministrativeGenderCode().getCode());
|
---|
417 | }
|
---|
418 |
|
---|
419 | public static void assertGenderEquals(String gender, PRPAIN201305UV message) {
|
---|
420 | assertNotNull(message.getControlActProcess());
|
---|
421 | assertParamListNotNull(message.getControlActProcess());
|
---|
422 |
|
---|
423 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectAdministrativeGender());
|
---|
424 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectAdministrativeGender().get(0));
|
---|
425 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectAdministrativeGender().get(0).getValue());
|
---|
426 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectAdministrativeGender().get(0).getValue().get(0));
|
---|
427 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectAdministrativeGender().get(0).getValue().get(0).getCode());
|
---|
428 | assertEquals(gender, message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectAdministrativeGender().get(0).getValue().get(0).getCode());
|
---|
429 | }
|
---|
430 |
|
---|
431 | public static void assertGenderNull(PRPAIN201301UV message) {
|
---|
432 | assertNotNull(message.getControlActProcess());
|
---|
433 | assertPatientPersonNotNull(message.getControlActProcess());
|
---|
434 |
|
---|
435 | assertNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAdministrativeGenderCode());
|
---|
436 | }
|
---|
437 |
|
---|
438 | public static void assertGenderNull(PRPAIN201302UV message) {
|
---|
439 | assertNotNull(message.getControlActProcess());
|
---|
440 | assertPatientPersonNotNull(message.getControlActProcess());
|
---|
441 |
|
---|
442 | assertNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getAdministrativeGenderCode());
|
---|
443 | }
|
---|
444 |
|
---|
445 | public static void assertGenderNull(PRPAIN201305UV message) {
|
---|
446 | assertNotNull(message.getControlActProcess());
|
---|
447 | assertParamListNotNull(message.getControlActProcess());
|
---|
448 |
|
---|
449 | assertEquals(0, message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectAdministrativeGender().size());
|
---|
450 | }
|
---|
451 |
|
---|
452 | public static void assertBirthTimeEquals(String birthTime, PRPAIN201301UV message) {
|
---|
453 | assertNotNull(message.getControlActProcess());
|
---|
454 | assertPatientPersonNotNull(message.getControlActProcess());
|
---|
455 |
|
---|
456 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getBirthTime());
|
---|
457 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getBirthTime().getValue());
|
---|
458 | assertEquals(birthTime, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getBirthTime().getValue());
|
---|
459 | }
|
---|
460 |
|
---|
461 | public static void assertBirthTimeEquals(String birthTime, PRPAIN201302UV message) {
|
---|
462 | assertNotNull(message.getControlActProcess());
|
---|
463 | assertPatientPersonNotNull(message.getControlActProcess());
|
---|
464 |
|
---|
465 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getBirthTime());
|
---|
466 | assertNotNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getBirthTime().getValue());
|
---|
467 | assertEquals(birthTime, message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getBirthTime().getValue());
|
---|
468 | }
|
---|
469 |
|
---|
470 | public static void assertBirthTimeEquals(String birthTime, PRPAIN201305UV message) {
|
---|
471 | assertNotNull(message.getControlActProcess());
|
---|
472 | assertParamListNotNull(message.getControlActProcess());
|
---|
473 |
|
---|
474 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectBirthTime());
|
---|
475 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectBirthTime().get(0));
|
---|
476 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectBirthTime().get(0).getValue());
|
---|
477 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectBirthTime().get(0).getValue().get(0));
|
---|
478 | assertNotNull(message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectBirthTime().get(0).getValue().get(0).getValue());
|
---|
479 | assertEquals(birthTime, message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectBirthTime().get(0).getValue().get(0).getValue());
|
---|
480 | }
|
---|
481 |
|
---|
482 | public static void assertBirthTimeNull(PRPAIN201301UV message) {
|
---|
483 | assertNotNull(message.getControlActProcess());
|
---|
484 | assertPatientPersonNotNull(message.getControlActProcess());
|
---|
485 |
|
---|
486 | assertNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getBirthTime());
|
---|
487 | }
|
---|
488 |
|
---|
489 | public static void assertBirthTimeNull(PRPAIN201302UV message) {
|
---|
490 | assertNotNull(message.getControlActProcess());
|
---|
491 | assertPatientPersonNotNull(message.getControlActProcess());
|
---|
492 |
|
---|
493 | assertNull(message.getControlActProcess().getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue().getBirthTime());
|
---|
494 | }
|
---|
495 |
|
---|
496 | public static void assertBirthTimeNull(PRPAIN201305UV message) {
|
---|
497 | assertNotNull(message.getControlActProcess());
|
---|
498 | assertParamListNotNull(message.getControlActProcess());
|
---|
499 |
|
---|
500 | assertEquals(0, message.getControlActProcess().getQueryByParameter().getValue().getParameterList().getLivingSubjectBirthTime().size());
|
---|
501 | }
|
---|
502 |
|
---|
503 | public static void assertPatientNotNull(PRPAIN201301UVMFMIMT700701UV01ControlActProcess controlActProcess) {
|
---|
504 | assertNotNull(controlActProcess.getSubject());
|
---|
505 | assertNotNull(controlActProcess.getSubject().get(0));
|
---|
506 | assertNotNull(controlActProcess.getSubject().get(0).getRegistrationEvent());
|
---|
507 | assertNotNull(controlActProcess.getSubject().get(0).getRegistrationEvent().getSubject1());
|
---|
508 | assertNotNull(controlActProcess.getSubject().get(0).getRegistrationEvent().getSubject1().getPatient());
|
---|
509 | assertNotNull(controlActProcess.getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getId());
|
---|
510 | assertNotNull(controlActProcess.getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getId().get(0));
|
---|
511 | assertNotNull(controlActProcess.getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getId().get(0).getRoot());
|
---|
512 | }
|
---|
513 |
|
---|
514 | public static void assertPatientNotNull(PRPAIN201302UVMFMIMT700701UV01ControlActProcess controlActProcess) {
|
---|
515 | assertNotNull(controlActProcess.getSubject());
|
---|
516 | assertNotNull(controlActProcess.getSubject().get(0));
|
---|
517 | assertNotNull(controlActProcess.getSubject().get(0).getRegistrationEvent());
|
---|
518 | assertNotNull(controlActProcess.getSubject().get(0).getRegistrationEvent().getSubject1());
|
---|
519 | assertNotNull(controlActProcess.getSubject().get(0).getRegistrationEvent().getSubject1().getPatient());
|
---|
520 | assertNotNull(controlActProcess.getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getId());
|
---|
521 | assertNotNull(controlActProcess.getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getId().get(0));
|
---|
522 | assertNotNull(controlActProcess.getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getId().get(0).getRoot());
|
---|
523 | }
|
---|
524 |
|
---|
525 | public static void assertPatientPersonNotNull(PRPAIN201301UVMFMIMT700701UV01ControlActProcess controlActProcess) {
|
---|
526 | assertPatientNotNull(controlActProcess);
|
---|
527 | assertNotNull(controlActProcess.getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson());
|
---|
528 | assertNotNull(controlActProcess.getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue());
|
---|
529 | }
|
---|
530 |
|
---|
531 | public static void assertPatientPersonNotNull(PRPAIN201302UVMFMIMT700701UV01ControlActProcess controlActProcess) {
|
---|
532 | assertPatientNotNull(controlActProcess);
|
---|
533 | assertNotNull(controlActProcess.getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson());
|
---|
534 | assertNotNull(controlActProcess.getSubject().get(0).getRegistrationEvent().getSubject1().getPatient().getPatientPerson().getValue());
|
---|
535 | }
|
---|
536 |
|
---|
537 | public static void assertParamListNotNull(PRPAIN201305UVQUQIMT021001UV01ControlActProcess controlActProcess) {
|
---|
538 | assertNotNull(controlActProcess.getQueryByParameter());
|
---|
539 | assertNotNull(controlActProcess.getQueryByParameter().getValue());
|
---|
540 | assertNotNull(controlActProcess.getQueryByParameter().getValue().getParameterList());
|
---|
541 | }
|
---|
542 |
|
---|
543 | static void assertQueryParam(PRPAMT201307UVQueryByParameter queryParam, PRPAIN201310UV message) {
|
---|
544 | assertNotNull(message.getControlActProcess());
|
---|
545 | assertNotNull(message.getControlActProcess().getQueryAck());
|
---|
546 | assertNotNull(message.getControlActProcess().getQueryAck().getQueryResponseCode());
|
---|
547 |
|
---|
548 | if (queryParam.getQueryId() != null) {
|
---|
549 | String matchId = queryParam.getQueryId().getRoot();
|
---|
550 | if (matchId != null && !matchId.isEmpty()) {
|
---|
551 | assertEquals(queryParam.getQueryId().getRoot(), message.getControlActProcess().getQueryAck().getQueryId().getRoot());
|
---|
552 | }
|
---|
553 | }
|
---|
554 | }
|
---|
555 | }
|
---|