spring-framework / org.springframework.test.web.servlet.result / XpathResultMatchers

XpathResultMatchers

open class XpathResultMatchers

Factory for assertions on the response content using XPath expressions.

An instance of this class is typically accessed via MockMvcResultMatchers#xpath.

Author
Rossen Stoyanchev

Since
3.2

Functions

booleanValue

open fun booleanValue(value: Boolean): ResultMatcher

Evaluate the XPath and assert the Boolean value found.

doesNotExist

open fun doesNotExist(): ResultMatcher

Evaluate the XPath and assert that content doesn't exist.

exists

open fun exists(): ResultMatcher

Evaluate the XPath and assert that content exists.

node

open fun node(matcher: Matcher<in Node>): ResultMatcher

Evaluate the XPath and assert the Node content found with the given Hamcrest Matcher.

nodeCount

open fun nodeCount(matcher: Matcher<Int>): ResultMatcher

Evaluate the XPath and assert the number of nodes found with the given Hamcrest Matcher.

open fun nodeCount(expectedCount: Int): ResultMatcher

Evaluate the XPath and assert the number of nodes found.

number

open fun number(matcher: Matcher<in Double>): ResultMatcher

Evaluate the XPath and assert the Double value found with the given Hamcrest Matcher.

open fun number(expectedValue: Double): ResultMatcher

Evaluate the XPath and assert the Double value found.

string

open fun string(matcher: Matcher<in String>): ResultMatcher

Apply the XPath and assert the String value found with the given Hamcrest Matcher.

open fun string(expectedValue: String): ResultMatcher

Apply the XPath and assert the String value found.