@Test public void checkErrorMergedPatId() throws Exception { log.info( "\n############################# TEST: check merged PatId ############################"); String mergedPID = XDSTestUtil.TEST_PID_MERGED + XDSTestUtil.TEST_ISSUER; session.linkPatient(mergedPID, XDSTestUtil.TEST_PID_1 + XDSTestUtil.TEST_ISSUER); SubmitObjectsRequest req = XDSTestUtil.getSubmitObjectsRequest(TEST_METADATA_FILENAME); RegistryObjectType obj = (RegistryObjectType) req.getRegistryObjectList().getIdentifiable().get(0).getValue(); XDSTestUtil.setExternalIdentifierValue( obj.getExternalIdentifier(), XDSConstants.UUID_XDSDocumentEntry_patientId, mergedPID); doRegisterDocumentAndCheckError( req, XDSException.XDS_ERR_PATID_DOESNOT_MATCH, "Check merged PID"); session.linkPatient(mergedPID, null); }
private void doRegisterDocumentAndCheckError( SubmitObjectsRequest req, String errorCode, String prefix) { RegistryResponseType rsp = null; try { rsp = session.documentRegistryRegisterDocumentSetB(req); } catch (Exception x) { fail(prefix + ": Register document failed unexpected! Error:" + x); } if (!XDSConstants.XDS_B_STATUS_FAILURE.equals(rsp.getStatus())) { fail(prefix + ": Register document should fail with error code:" + errorCode); } String error = rsp.getRegistryErrorList().getRegistryError().get(0).getErrorCode(); assertEquals(prefix + ": Error code:", errorCode, error); }