Hl7v3TransformerImpl implements Hl7v3Transformer { @Override public String getPixQueryXml(String mrn, String mrnDomain, String xsltUri) throws Hl7v3TransformerException { String newxsltUri = ""; try { final String extension = "@extension"; final String root = "@root"; String queryXML = xsltUri; if (null != xsltUri && !xsltUri.startsWith("<?xml")) { final InputStream styleIs = Thread.currentThread() .getContextClassLoader().getResourceAsStream(xsltUri); queryXML = IOUtils.toString(styleIs, "UTF-8"); } newxsltUri = queryXML.replaceAll(extension, mrn); newxsltUri = newxsltUri.replaceAll(root, mrnDomain); } catch (final Exception e) { final String errorMessage = "Error happended when trying to mrn data to hl7v3PixQuery"; logger.error(errorMessage, e); final Hl7v3TransformerException transformerException = new Hl7v3TransformerException( errorMessage, e); throw transformerException; } return newxsltUri; } Hl7v3TransformerImpl(XmlTransformer xmlTransformer); @Override String getPixQueryXml(String mrn, String mrnDomain, String xsltUri); @Override String transformToHl7v3PixXml(String xml, String XSLTURI);  }
@Test public void testGetPixQueryXml() throws IOException, URISyntaxException, Hl7v3TransformerException { final String mrnMock = "mrnMock"; final String mrnDomainMock = "mrnDomainMock"; final String picQueryxml = FileUtils.readFileToString(new File( getClass().getClassLoader() .getResource("xml/c32ToHl7v3PixQuery.xsl").toURI())); final String hl7v3PixXML = sut.getPixQueryXml(mrnMock, mrnDomainMock, picQueryxml); assertNotNull(hl7v3PixXML); }