@SuppressWarnings("unchecked") @Test public void testQueryPerson_Query_Failure_IOException() throws Hl7v3TransformerException, JAXBException, IOException { String expectedErrorMessage = "Query Failure! Server error! A unexpected error has occured"; String hl7v3 = "hl7v3"; when( hl7v3Transformer.getPixQueryXml(MRN, MRN_DOMAIN, Hl7v3Transformer.XML_PIX_QUERY)).thenReturn(hl7v3); when( requestXMLToJava.getPIXQueryReqObject(hl7v3, PixManagerConstants.ENCODE_STRING)).thenThrow( IOException.class); PixManagerBean bean = sut.queryPatient(MRN, MRN_DOMAIN); assertEquals(expectedErrorMessage, bean.getQueryMessage()); }
@Override public PixManagerBean queryPatient(String mrn, String mrnDomain) { logger.debug("Received request to PIXQuery"); PixManagerBean pixMgrBean = new PixManagerBean(); try { String xmlFilePath = hl7v3Transformer.getPixQueryXml(mrn, mrnDomain, Hl7v3Transformer.XML_PIX_QUERY); PRPAIN201309UV02 request = new PRPAIN201309UV02(); PRPAIN201310UV02 response = new PRPAIN201310UV02(); request = requestXMLToJava.getPIXQueryReqObject(xmlFilePath, PixManagerConstants.ENCODE_STRING); logDebug("PIX QUERY Request: ", request); response = pixManagerService.pixManagerPRPAIN201309UV02(request); logDebug("PIX QUERY Response: ", response); pixManagerMessageHelper.getQueryMessage(response, pixMgrBean); } catch (Hl7v3TransformerException e) { pixManagerMessageHelper.getGeneralExpMessage(e, pixMgrBean, PixManagerConstants.PIX_QUERY); throw new IllegalArgumentException(e); } catch (JAXBException | IOException e) { pixManagerMessageHelper.getGeneralExpMessage(e, pixMgrBean, PixManagerConstants.PIX_QUERY); } return pixMgrBean; }
PixServiceImpl implements PixService { @Override public PixManagerBean queryPatient(String mrn, String mrnDomain) { logger.debug("Received request to PIXQuery"); PixManagerBean pixMgrBean = new PixManagerBean(); try { String xmlFilePath = hl7v3Transformer.getPixQueryXml(mrn, mrnDomain, Hl7v3Transformer.XML_PIX_QUERY); PRPAIN201309UV02 request = new PRPAIN201309UV02(); PRPAIN201310UV02 response = new PRPAIN201310UV02(); request = requestXMLToJava.getPIXQueryReqObject(xmlFilePath, PixManagerConstants.ENCODE_STRING); logDebug("PIX QUERY Request: ", request); response = pixManagerService.pixManagerPRPAIN201309UV02(request); logDebug("PIX QUERY Response: ", response); pixManagerMessageHelper.getQueryMessage(response, pixMgrBean); } catch (Hl7v3TransformerException e) { pixManagerMessageHelper.getGeneralExpMessage(e, pixMgrBean, PixManagerConstants.PIX_QUERY); throw new IllegalArgumentException(e); } catch (JAXBException | IOException e) { pixManagerMessageHelper.getGeneralExpMessage(e, pixMgrBean, PixManagerConstants.PIX_QUERY); } return pixMgrBean; } }
PixServiceImpl implements PixService { @Override public PixManagerBean queryPatient(String mrn, String mrnDomain) { logger.debug("Received request to PIXQuery"); PixManagerBean pixMgrBean = new PixManagerBean(); try { String xmlFilePath = hl7v3Transformer.getPixQueryXml(mrn, mrnDomain, Hl7v3Transformer.XML_PIX_QUERY); PRPAIN201309UV02 request = new PRPAIN201309UV02(); PRPAIN201310UV02 response = new PRPAIN201310UV02(); request = requestXMLToJava.getPIXQueryReqObject(xmlFilePath, PixManagerConstants.ENCODE_STRING); logDebug("PIX QUERY Request: ", request); response = pixManagerService.pixManagerPRPAIN201309UV02(request); logDebug("PIX QUERY Response: ", response); pixManagerMessageHelper.getQueryMessage(response, pixMgrBean); } catch (Hl7v3TransformerException e) { pixManagerMessageHelper.getGeneralExpMessage(e, pixMgrBean, PixManagerConstants.PIX_QUERY); throw new IllegalArgumentException(e); } catch (JAXBException | IOException e) { pixManagerMessageHelper.getGeneralExpMessage(e, pixMgrBean, PixManagerConstants.PIX_QUERY); } return pixMgrBean; } PixServiceImpl(String mrnDomain, String pidPrefix,
			PixManagerRequestXMLToJava requestXMLToJava,
			PixManagerService pixManagerService,
			PixManagerMessageHelper pixManagerMessageHelper,
			Hl7v3Transformer hl7v3Transformer, SimpleMarshaller simpleMarshaller); }
PixServiceImpl implements PixService { @Override public PixManagerBean queryPatient(String mrn, String mrnDomain) { logger.debug("Received request to PIXQuery"); PixManagerBean pixMgrBean = new PixManagerBean(); try { String xmlFilePath = hl7v3Transformer.getPixQueryXml(mrn, mrnDomain, Hl7v3Transformer.XML_PIX_QUERY); PRPAIN201309UV02 request = new PRPAIN201309UV02(); PRPAIN201310UV02 response = new PRPAIN201310UV02(); request = requestXMLToJava.getPIXQueryReqObject(xmlFilePath, PixManagerConstants.ENCODE_STRING); logDebug("PIX QUERY Request: ", request); response = pixManagerService.pixManagerPRPAIN201309UV02(request); logDebug("PIX QUERY Response: ", response); pixManagerMessageHelper.getQueryMessage(response, pixMgrBean); } catch (Hl7v3TransformerException e) { pixManagerMessageHelper.getGeneralExpMessage(e, pixMgrBean, PixManagerConstants.PIX_QUERY); throw new IllegalArgumentException(e); } catch (JAXBException | IOException e) { pixManagerMessageHelper.getGeneralExpMessage(e, pixMgrBean, PixManagerConstants.PIX_QUERY); } return pixMgrBean; } PixServiceImpl(String mrnDomain, String pidPrefix,
			PixManagerRequestXMLToJava requestXMLToJava,
			PixManagerService pixManagerService,
			PixManagerMessageHelper pixManagerMessageHelper,
			Hl7v3Transformer hl7v3Transformer, SimpleMarshaller simpleMarshaller); @Override String getEid(String mrn); @Override PixManagerBean queryPatient(String mrn, String mrnDomain); @Override PixManagerBean addPatient(PixPatientDto pixPatientDto); @Override PixManagerBean updatePatient(PixPatientDto pixPatientDto); }
PixServiceImpl implements PixService { @Override public PixManagerBean queryPatient(String mrn, String mrnDomain) { logger.debug("Received request to PIXQuery"); PixManagerBean pixMgrBean = new PixManagerBean(); try { String xmlFilePath = hl7v3Transformer.getPixQueryXml(mrn, mrnDomain, Hl7v3Transformer.XML_PIX_QUERY); PRPAIN201309UV02 request = new PRPAIN201309UV02(); PRPAIN201310UV02 response = new PRPAIN201310UV02(); request = requestXMLToJava.getPIXQueryReqObject(xmlFilePath, PixManagerConstants.ENCODE_STRING); logDebug("PIX QUERY Request: ", request); response = pixManagerService.pixManagerPRPAIN201309UV02(request); logDebug("PIX QUERY Response: ", response); pixManagerMessageHelper.getQueryMessage(response, pixMgrBean); } catch (Hl7v3TransformerException e) { pixManagerMessageHelper.getGeneralExpMessage(e, pixMgrBean, PixManagerConstants.PIX_QUERY); throw new IllegalArgumentException(e); } catch (JAXBException | IOException e) { pixManagerMessageHelper.getGeneralExpMessage(e, pixMgrBean, PixManagerConstants.PIX_QUERY); } return pixMgrBean; } PixServiceImpl(String mrnDomain, String pidPrefix,
			PixManagerRequestXMLToJava requestXMLToJava,
			PixManagerService pixManagerService,
			PixManagerMessageHelper pixManagerMessageHelper,
			Hl7v3Transformer hl7v3Transformer, SimpleMarshaller simpleMarshaller); @Override String getEid(String mrn); @Override PixManagerBean queryPatient(String mrn, String mrnDomain); @Override PixManagerBean addPatient(PixPatientDto pixPatientDto); @Override PixManagerBean updatePatient(PixPatientDto pixPatientDto);  }