Test fix
This commit is contained in:
parent
554653d883
commit
d819d685ee
|
@ -1757,8 +1757,8 @@ public class XmlUtil {
|
||||||
|
|
||||||
private static void throwUnitTestExceptionIfConfiguredToDoSo() throws FactoryConfigurationError, XMLStreamException {
|
private static void throwUnitTestExceptionIfConfiguredToDoSo() throws FactoryConfigurationError, XMLStreamException {
|
||||||
if (ourNextException != null) {
|
if (ourNextException != null) {
|
||||||
if (ourNextException instanceof FactoryConfigurationError) {
|
if (ourNextException instanceof javax.xml.stream.FactoryConfigurationError) {
|
||||||
throw ((FactoryConfigurationError)ourNextException);
|
throw ((javax.xml.stream.FactoryConfigurationError)ourNextException);
|
||||||
}
|
}
|
||||||
throw (XMLStreamException)ourNextException;
|
throw (XMLStreamException)ourNextException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.util;
|
||||||
|
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import javax.xml.parsers.FactoryConfigurationError;
|
import javax.xml.stream.FactoryConfigurationError;
|
||||||
import javax.xml.stream.XMLStreamException;
|
import javax.xml.stream.XMLStreamException;
|
||||||
|
|
||||||
import org.hl7.fhir.dstu3.model.Patient;
|
import org.hl7.fhir.dstu3.model.Patient;
|
||||||
|
@ -38,6 +38,7 @@ public class XmlUtilDstu3Test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testXmlFactoryThrowsXmlStreamException() {
|
public void testXmlFactoryThrowsXmlStreamException() {
|
||||||
XmlUtil.setThrowExceptionForUnitTest(new XMLStreamException("FOO"));
|
XmlUtil.setThrowExceptionForUnitTest(new XMLStreamException("FOO"));
|
||||||
|
|
||||||
|
@ -55,18 +56,13 @@ public class XmlUtilDstu3Test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testXmlFactoryThrowsFactoryConfigurationError() {
|
public void testXmlFactoryThrowsFactoryConfigurationError() {
|
||||||
XmlUtil.setThrowExceptionForUnitTest(new FactoryConfigurationError("FOO"));
|
XmlUtil.setThrowExceptionForUnitTest(new FactoryConfigurationError("FOO"));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ourCtx.newXmlParser().parseResource("AAAAA");
|
ourCtx.newXmlParser().parseResource("AAAAA");
|
||||||
fail();
|
fail();
|
||||||
} catch (DataFormatException e) {
|
|
||||||
// good
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
ourCtx.newXmlParser().encodeResourceToString(myPatient);
|
|
||||||
fail();
|
|
||||||
} catch (ConfigurationException e) {
|
} catch (ConfigurationException e) {
|
||||||
// good
|
// good
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,6 +204,8 @@
|
||||||
<groupId>org.apache.httpcomponents</groupId>
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
<artifactId>httpclient</artifactId>
|
<artifactId>httpclient</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<reporting>
|
<reporting>
|
||||||
|
|
Loading…
Reference in New Issue