HL7AckTransforms { public static MCCIIN000002UV01 createAckErrorFrom201305(PRPAIN201305UV02 request, String ackMsgText) { MCCIIN000002UV01 ack = new MCCIIN000002UV01(); II msgId = new II(); if (request != null) { if (request.getId() != null) { msgId = request.getId(); } String senderOID = getMCCIMT000100UV01RepresentedOrganizationRootOID(request.getSender()); ack = HL7AckTransforms.createAckMessage(null, msgId, ACK_TYPE_CODE_ERROR, ackMsgText, senderOID, senderOID); } return ack; } HL7AckTransforms();   HL7AckTransforms(HL7MessageIdGenerator idGenerator); static MCCIIN000002UV01 createAckFrom201305(PRPAIN201305UV02 request, String ackMsgText); static MCCIIN000002UV01 createAckErrorFrom201305(PRPAIN201305UV02 request, String ackMsgText); static MCCIIN000002UV01 createAckFrom201306(PRPAIN201306UV02 request, String ackMsgText); static MCCIIN000002UV01 createAckErrorFrom201306(PRPAIN201306UV02 request, String ackMsgText); static MCCIIN000002UV01 createAckMessage(String localDeviceId, II origMsgId, String ackTypeCode,
            String msgText, String senderOID, String receiverOID); static MCCIMT000200UV01Acknowledgement createAcknowledgement(II msgId, String ackTypeCode, String msgText); static MCCIMT000200UV01TargetMessage createTargetMessage(II msgId); static MCCIMT000200UV01AcknowledgementDetail createAckDetail(String ackTypeCode, String msgText); static final String ACK_DETAIL_TYPE_CODE_ERROR; static final String ACK_DETAIL_TYPE_CODE_INFO; static final String ACK_TYPE_CODE_ACCEPT; static final String ACK_TYPE_CODE_ERROR; }
@Test public void checkOIDOfInitiatorErrorMessage() { MCCIIN000002UV01 ack = new MCCIIN000002UV01(); String SenderOID = "1.1"; String ackMsg = "No targets were found for the Patient Discovery Request"; HL7AckTransforms ackTransform = new HL7AckTransforms(idGenerator); ack = ackTransform.createAckErrorFrom201305(createPRPAIN201305UV02(SenderOID), ackMsg); assertEquals("1.1", ack.getReceiver().get(0).getDevice().getAsAgent().getValue().getRepresentedOrganization() .getValue().getId().get(0).getRoot()); }
@Test public void testCreateAckErrorFrom201305WhenRequestNull() { PRPAIN201305UV02 request = null; String ackMsgText = null; HL7AckTransforms ackTransform = new HL7AckTransforms(idGenerator); assertNull(ackTransform.createAckErrorFrom201305(request, ackMsgText).getAcceptAckCode()); }
@Test public void testCreateAckErrorFrom201305WhenMessageIdNull() { String senderOID = "1.1"; PRPAIN201305UV02 request = createPRPAIN201305UV02(senderOID); String ackMsgText = null; HL7AckTransforms ackTransform = new HL7AckTransforms(idGenerator); assertNotNull(ackTransform.createAckErrorFrom201305(request, ackMsgText).getId().getRoot()); }
@Test public void testCreateAckErrorFrom201305WhenMsgTxtNull() { String senderOID = "1.1"; PRPAIN201305UV02 request = createPRPAIN201305UV02(senderOID); request = setMessageId(request); String ackMsgText = null; HL7AckTransforms ackTransform = new HL7AckTransforms(idGenerator); assertTrue(ackTransform.createAckErrorFrom201305(request, ackMsgText).getAcknowledgement().get(0) .getAcknowledgementDetail().isEmpty()); }
@Test public void testCreateAckErrorFrom201305WhenMsgTxtandmsgIdNull() { String senderOID = "1.1"; PRPAIN201305UV02 request = createPRPAIN201305UV02(senderOID); String ackMsgText = null; HL7AckTransforms ackTransform = new HL7AckTransforms(idGenerator); MCCIIN000002UV01 ack = ackTransform.createAckErrorFrom201305(request, ackMsgText); assertTrue(ack.getAcknowledgement().isEmpty()); }