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