类 XmlExpectationsHelper
- java.lang.Object
- org.springframework.test.util.XmlExpectationsHelper
public class XmlExpectationsHelper extends Object
A helper class for assertions on XML content.- 从以下版本开始:
- 3.2
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 XmlExpectationsHelper()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
assertNode(String content, Matcher<? super Node> matcher)
void
assertSource(String content, Matcher<? super Source> matcher)
void
assertXmlEqual(String expected, String actual)
Parse the expected and actual content strings as XML and assert that the two are "similar" -- i.e. they contain the same elements and attributes regardless of order.
构造器详细资料
XmlExpectationsHelper
public XmlExpectationsHelper()
方法详细资料
assertNode
public void assertNode(String content, Matcher<? super Node> matcher) throws Exception
- 抛出:
Exception
assertSource
public void assertSource(String content, Matcher<? super Source> matcher) throws Exception
- 抛出:
Exception
- 另请参阅:
- xml-matchers
assertXmlEqual
public void assertXmlEqual(String expected, String actual) throws Exception
Parse the expected and actual content strings as XML and assert that the two are "similar" -- i.e. they contain the same elements and attributes regardless of order.Use of this method assumes the XMLUnit library is available.
- 参数:
expected
- the expected XML contentactual
- the actual XML content- 抛出:
Exception
- 另请参阅:
MockMvcResultMatchers.xpath(String, Object...)
,MockMvcResultMatchers.xpath(String, Map, Object...)