Class XpathRequestMatchers
java.lang.Object
org.springframework.test.web.client.match.XpathRequestMatchers
Factory methods for request content 
RequestMatcher implementations
 that use an XPath expression.
 An instance of this class is typically accessed via
 MockRestRequestMatchers.xpath(String, Object...) or
 MockRestRequestMatchers.xpath(String, Map, Object...).
- Since:
- 3.2
- Author:
- Rossen Stoyanchev, Sam Brannen
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanValue(Boolean value) Apply the XPath and assert the boolean value found.Assert that content does not exist at the given XPath.exists()Assert that content exists at the given XPath.Apply the XPath and assert it with the givenMatcher<Node>.nodeCount(int expectedCount) Apply the XPath and assert the number of nodes found.Apply the XPath and assert the number of nodes found with the givenMatcher<Integer>.Apply the XPath and assert the number value found.Apply the XPath and assert the number found with the given matcher.Apply the XPath and assert the String content found.Apply the XPath and assert the String content found with the given matcher.
- 
Constructor Details- 
XpathRequestMatchersprotected XpathRequestMatchers(String expression, @Nullable Map<String, String> namespaces, Object... args) throws XPathExpressionExceptionClass constructor, not for direct instantiation.Use MockRestRequestMatchers.xpath(String, Object...)orMockRestRequestMatchers.xpath(String, Map, Object...).- Parameters:
- expression- the XPath expression
- namespaces- the XML namespaces referenced in the XPath expression, or- null
- args- arguments to parameterize the XPath expression with, using the formatting specifiers defined in- String.format(String, Object...)
- Throws:
- XPathExpressionException- if expression compilation failed
 
 
- 
- 
Method Details- 
nodeApply the XPath and assert it with the givenMatcher<Node>.
- 
existsAssert that content exists at the given XPath.
- 
doesNotExistAssert that content does not exist at the given XPath.
- 
nodeCountApply the XPath and assert the number of nodes found with the givenMatcher<Integer>.
- 
nodeCountApply the XPath and assert the number of nodes found.
- 
stringApply the XPath and assert the String content found with the given matcher.
- 
stringApply the XPath and assert the String content found.
- 
numberApply the XPath and assert the number found with the given matcher.
- 
numberApply the XPath and assert the number value found.
- 
booleanValueApply the XPath and assert the boolean value found.
 
-