Class RestAssuredWebTestClientMatchers

java.lang.Object
io.restassured.module.webtestclient.matcher.RestAssuredWebTestClientMatchers

public class RestAssuredWebTestClientMatchers extends Object
Providers Hamcrest matchers that may be useful when validating a WebTestClient response.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static io.restassured.matcher.ResponseAwareMatcher<WebTestClientResponse>
    Creates a ResponseAwareMatcher that extracts the given path from the response and wraps it in a Matchers.equalTo(Object) matcher.
    static io.restassured.matcher.ResponseAwareMatcher<WebTestClientResponse>
    Creates a ResponseAwareMatcher that extracts the given path from the response and wraps it in a Matchers.equalTo(Object) matcher.
    static io.restassured.matcher.ResponseAwareMatcher<WebTestClientResponse>
    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>
    Evaluates to true if an XML string matches the supplied DTD.
    static org.hamcrest.Matcher<String>
    Evaluates to true if an XML string matches the supplied DTD.
    static org.hamcrest.Matcher<String>
    Evaluates to true if an XML string matches the supplied DTD.
    static org.hamcrest.Matcher<String>
    Evaluates to true if an XML string matches the supplied DTD.
    static org.hamcrest.Matcher<String>
    Evaluates to true if an XML file in classpath matches the supplied DTD.
    static org.hamcrest.Matcher<String>
    Evaluates to true if an XML string matches the supplied XSD (Xml Schema).
    static org.hamcrest.Matcher<String>
    Evaluates to true if an XML string matches the supplied XSD (Xml Schema).
    static org.hamcrest.Matcher<String>
    Evaluates to true if an XML string matches the supplied XSD (Xml Schema).
    static org.hamcrest.Matcher<String>
    Evaluates to true if an XML string matches the supplied XSD (Xml Schema).
    static org.hamcrest.Matcher<String>
    Evaluates to true if an XML file in classpath matches the supplied XSD.
    static io.restassured.matcher.ResponseAwareMatcher<WebTestClientResponse>
    Creates a ResponseAwareMatcher that extracts the given path from the response and wraps it in a Matchers.equalTo(Object) matcher.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RestAssuredWebTestClientMatchers

      public RestAssuredWebTestClientMatchers()
  • Method Details

    • matchesXsd

      public static org.hamcrest.Matcher<String> matchesXsd(String xsd)
      Evaluates to true if an XML string matches the supplied XSD (Xml Schema).
      Parameters:
      xsd - The XSD to match
      Returns:
      The XSD matcher
    • matchesXsd

      public static org.hamcrest.Matcher<String> matchesXsd(InputStream xsd)
      Evaluates to true if an XML string matches the supplied XSD (Xml Schema).
      Parameters:
      xsd - The XSD to match
      Returns:
      The XSD matcher
    • matchesXsd

      public static org.hamcrest.Matcher<String> matchesXsd(Reader xsd)
      Evaluates to true if an XML string matches the supplied XSD (Xml Schema).
      Parameters:
      xsd - The XSD to match
      Returns:
      The XSD matcher
    • matchesXsd

      public static org.hamcrest.Matcher<String> matchesXsd(File xsd)
      Evaluates to true if an XML string matches the supplied XSD (Xml Schema).
      Parameters:
      xsd - The XSD to match
      Returns:
      The XSD matcher
    • matchesXsdInClasspath

      public static org.hamcrest.Matcher<String> matchesXsdInClasspath(String path)
      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

      public static org.hamcrest.Matcher<String> matchesDtd(String dtd)
      Evaluates to true if an XML string matches the supplied DTD.
      Parameters:
      dtd - The DTD to match
      Returns:
      The DTD matcher
    • matchesDtd

      public static org.hamcrest.Matcher<String> matchesDtd(InputStream dtd)
      Evaluates to true if an XML string matches the supplied DTD.
      Parameters:
      dtd - The DTD to match
      Returns:
      The DTD matcher
    • matchesDtd

      public static org.hamcrest.Matcher<String> matchesDtd(File dtd)
      Evaluates to true if an XML string matches the supplied DTD.
      Parameters:
      dtd - The DTD to match
      Returns:
      The DTD matcher
    • matchesDtd

      public static org.hamcrest.Matcher<String> matchesDtd(URL url)
      Evaluates to true if an XML string matches the supplied DTD.
      Parameters:
      url - The DTD to match
      Returns:
      The DTD matcher
    • matchesDtdInClasspath

      public static org.hamcrest.Matcher<String> matchesDtdInClasspath(String path)
      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 a 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"));
       
      Parameters:
      path - The path to check
      Returns:
      A ResponseAwareMatcher
    • endsWithPath

      public static io.restassured.matcher.ResponseAwareMatcher<WebTestClientResponse> endsWithPath(String path)
      Creates a 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"));
       
      Parameters:
      path - The path to check
      Returns:
      A ResponseAwareMatcher
    • startsWithPath

      public static io.restassured.matcher.ResponseAwareMatcher<WebTestClientResponse> startsWithPath(String path)
      Creates a 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"));
       
      Parameters:
      path - The path to check
      Returns:
      A ResponseAwareMatcher
    • containsPath

      public static io.restassured.matcher.ResponseAwareMatcher<WebTestClientResponse> containsPath(String path)
      Creates a 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"));
       
      Parameters:
      path - The path to check
      Returns:
      A ResponseAwareMatcher