public class RestAssuredMatchers extends Object
| Constructor and Description |
|---|
RestAssuredMatchers() |
| Modifier and Type | Method and Description |
|---|---|
static ResponseAwareMatcher<Response> |
containsPath(String path)
Creates a
ResponseAwareMatcher that extracts the given path from the response and
wraps it in a Matchers.equalTo(Object) matcher. |
static ResponseAwareMatcher<Response> |
endsWithPath(String path)
Creates a
ResponseAwareMatcher that extracts the given path from the response and
wraps it in a Matchers.equalTo(Object) matcher. |
static ResponseAwareMatcher<Response> |
equalToPath(String path)
Creates a
ResponseAwareMatcher that extracts the given path from the response and
wraps it in a Matchers.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 XmlXsdMatcher |
matchesXsd(File xsd)
Evaluates to true if an XML string matches the supplied XSD (Xml Schema).
|
static XmlXsdMatcher |
matchesXsd(InputStream xsd)
Evaluates to true if an XML string matches the supplied XSD (Xml Schema).
|
static XmlXsdMatcher |
matchesXsd(Reader xsd)
Evaluates to true if an XML string matches the supplied XSD (Xml Schema).
|
static XmlXsdMatcher |
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 ResponseAwareMatcher<Response> |
startsWithPath(String path)
Creates a
ResponseAwareMatcher that extracts the given path from the response and
wraps it in a Matchers.equalTo(Object) matcher. |
public static XmlXsdMatcher matchesXsd(String xsd)
xsd - The XSD to matchpublic static XmlXsdMatcher matchesXsd(InputStream xsd)
xsd - The XSD to matchpublic static XmlXsdMatcher matchesXsd(Reader xsd)
xsd - The XSD to matchpublic static XmlXsdMatcher matchesXsd(File xsd)
xsd - The XSD to matchpublic static org.hamcrest.Matcher<String> matchesXsdInClasspath(String path)
path - The path to the XSD located in classpathpublic static org.hamcrest.Matcher<String> matchesDtd(String dtd)
dtd - The DTD to matchpublic static org.hamcrest.Matcher<String> matchesDtd(InputStream dtd)
dtd - The DTD to matchpublic static org.hamcrest.Matcher<String> matchesDtd(File dtd)
dtd - The DTD to matchpublic static org.hamcrest.Matcher<String> matchesDtd(URL url)
url - The DTD to matchpublic static org.hamcrest.Matcher<String> matchesDtdInClasspath(String path)
path - The path to the DTD file in classpathpublic static ResponseAwareMatcher<Response> equalToPath(String path)
ResponseAwareMatcher that extracts the given path from the response and
wraps it in a Matchers.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"));
path - The path to checkResponseAwareMatcherpublic static ResponseAwareMatcher<Response> endsWithPath(String path)
ResponseAwareMatcher that extracts the given path from the response and
wraps it in a Matchers.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"));
path - The path to checkResponseAwareMatcherpublic static ResponseAwareMatcher<Response> startsWithPath(String path)
ResponseAwareMatcher that extracts the given path from the response and
wraps it in a Matchers.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"));
path - The path to checkResponseAwareMatcherpublic static ResponseAwareMatcher<Response> containsPath(String path)
ResponseAwareMatcher that extracts the given path from the response and
wraps it in a Matchers.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"));
path - The path to checkResponseAwareMatcherCopyright © 2010–2014. All rights reserved.