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