在我的单元测试中,我试图通过将一些格式错误的 xml 发送到 javax.xml.transform.Transformer 的 org.apache.xalan.processor.TransformerFactoryImpl 实现来引发 TransformException 错误
打电话
transform(Source xmlSource,Result outputTarget) throws TransformerException
控制台显示以下消息,但没有抛出 TransformerException
file:/filepath/MalformedInput.xml; Line #85; Column #16; XML document structures must start and end within the same entity.
关于它为什么不抛出 TransformerException 或者我如何在这种情况下引发异常的任何想法?
我尝试过使用 saxon 并抛出了 TransformerException,但我更喜欢使用 xalan
谢谢