Class RestAssuredWebTestClientMatchers
java.lang.Object
io.restassured.module.webtestclient.matcher.RestAssuredWebTestClientMatchers
Providers Hamcrest matchers that may be useful when validating a WebTestClient response.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic io.restassured.matcher.ResponseAwareMatcher<WebTestClientResponse>containsPath(String path) Creates aResponseAwareMatcherthat extracts the given path from the response and wraps it in aMatchers.equalTo(Object)matcher.static io.restassured.matcher.ResponseAwareMatcher<WebTestClientResponse>endsWithPath(String path) Creates aResponseAwareMatcherthat extracts the given path from the response and wraps it in aMatchers.equalTo(Object)matcher.static io.restassured.matcher.ResponseAwareMatcher<WebTestClientResponse>equalToPath(String path) Creates aResponseAwareMatcherthat extracts the given path from the response and wraps it in aMatchers.equalTo(Object)matcher.static org.hamcrest.Matcher<String>matchesDtd(File dtd) Evaluates to true if an XML string matches the supplied DTD.static org.hamcrest.Matcher<String>matchesDtd(InputStream dtd) Evaluates to true if an XML string matches the supplied DTD.static org.hamcrest.Matcher<String>matchesDtd(String dtd) Evaluates to true if an XML string matches the supplied DTD.static org.hamcrest.Matcher<String>matchesDtd(URL url) Evaluates to true if an XML string matches the supplied DTD.static org.hamcrest.Matcher<String>matchesDtdInClasspath(String path) Evaluates to true if an XML file in classpath matches the supplied DTD.static org.hamcrest.Matcher<String>matchesXsd(File xsd) Evaluates to true if an XML string matches the supplied XSD (Xml Schema).static org.hamcrest.Matcher<String>matchesXsd(InputStream xsd) Evaluates to true if an XML string matches the supplied XSD (Xml Schema).static org.hamcrest.Matcher<String>matchesXsd(Reader xsd) Evaluates to true if an XML string matches the supplied XSD (Xml Schema).static org.hamcrest.Matcher<String>matchesXsd(String xsd) Evaluates to true if an XML string matches the supplied XSD (Xml Schema).static org.hamcrest.Matcher<String>matchesXsdInClasspath(String path) Evaluates to true if an XML file in classpath matches the supplied XSD.static io.restassured.matcher.ResponseAwareMatcher<WebTestClientResponse>startsWithPath(String path) Creates aResponseAwareMatcherthat extracts the given path from the response and wraps it in aMatchers.equalTo(Object)matcher.
-
Constructor Details
-
RestAssuredWebTestClientMatchers
public RestAssuredWebTestClientMatchers()
-
-
Method Details
-
matchesXsd
Evaluates to true if an XML string matches the supplied XSD (Xml Schema).- Parameters:
xsd- The XSD to match- Returns:
- The XSD matcher
-
matchesXsd
Evaluates to true if an XML string matches the supplied XSD (Xml Schema).- Parameters:
xsd- The XSD to match- Returns:
- The XSD matcher
-
matchesXsd
Evaluates to true if an XML string matches the supplied XSD (Xml Schema).- Parameters:
xsd- The XSD to match- Returns:
- The XSD matcher
-
matchesXsd
Evaluates to true if an XML string matches the supplied XSD (Xml Schema).- Parameters:
xsd- The XSD to match- Returns:
- The XSD matcher
-
matchesXsdInClasspath
Evaluates to true if an XML file in classpath matches the supplied XSD.- Parameters:
path- The path to the XSD located in classpath- Returns:
- The DTD matcher
-
matchesDtd
Evaluates to true if an XML string matches the supplied DTD.- Parameters:
dtd- The DTD to match- Returns:
- The DTD matcher
-
matchesDtd
Evaluates to true if an XML string matches the supplied DTD.- Parameters:
dtd- The DTD to match- Returns:
- The DTD matcher
-
matchesDtd
Evaluates to true if an XML string matches the supplied DTD.- Parameters:
dtd- The DTD to match- Returns:
- The DTD matcher
-
matchesDtd
Evaluates to true if an XML string matches the supplied DTD.- Parameters:
url- The DTD to match- Returns:
- The DTD matcher
-
matchesDtdInClasspath
Evaluates to true if an XML file in classpath matches the supplied DTD.- Parameters:
path- The path to the DTD file in classpath- Returns:
- The DTD matcher
-
equalToPath
public static io.restassured.matcher.ResponseAwareMatcher<WebTestClientResponse> equalToPath(String path) Creates aResponseAwareMatcherthat extracts the given path from the response and wraps it in aMatchers.equalTo(Object)matcher. This is useful if you have a resource that e.g. returns the given JSON:{ "userId" : "my-id", "playerId" : "my-id" }you can then test it like this:get("/x").then().body("userId", equalToPath("playerId"));- Parameters:
path- The path to check- Returns:
- A
ResponseAwareMatcher
-
endsWithPath
public static io.restassured.matcher.ResponseAwareMatcher<WebTestClientResponse> endsWithPath(String path) Creates aResponseAwareMatcherthat extracts the given path from the response and wraps it in aMatchers.equalTo(Object)matcher. This is useful if you have a resource that e.g. returns the given JSON:{ "userId" : "my-id", "href" : "http://localhost:8080/my-id" }you can then test it like this:get("/x").then().body("href", endsWithPath("userId"));- Parameters:
path- The path to check- Returns:
- A
ResponseAwareMatcher
-
startsWithPath
public static io.restassured.matcher.ResponseAwareMatcher<WebTestClientResponse> startsWithPath(String path) Creates aResponseAwareMatcherthat extracts the given path from the response and wraps it in aMatchers.equalTo(Object)matcher. This is useful if you have a resource that e.g. returns the given JSON:{ "userId" : "my-id", "baseUri" : "http://localhost:8080", "href" : "http://localhost:8080/my-id" }you can then test it like this:get("/x").then().body("href", startsWithPath("baseUri"));- Parameters:
path- The path to check- Returns:
- A
ResponseAwareMatcher
-
containsPath
public static io.restassured.matcher.ResponseAwareMatcher<WebTestClientResponse> containsPath(String path) Creates aResponseAwareMatcherthat extracts the given path from the response and wraps it in aMatchers.equalTo(Object)matcher. This is useful if you have a resource that e.g. returns the given JSON:{ "userId" : "my-id", "href" : "http://localhost:8080/my-id" }you can then test it like this:get("/x").then().body("href", containsPath("userId"));- Parameters:
path- The path to check- Returns:
- A
ResponseAwareMatcher
-