Class SerenityRest

java.lang.Object
net.serenitybdd.rest.SerenityRest

public class SerenityRest
extends java.lang.Object
User: YamStranger Date: 3/14/16 Time: 8:51 AM
  • Constructor Summary

    Constructors
    Constructor Description
    SerenityRest()  
  • Method Summary

    Modifier and Type Method Description
    static io.restassured.response.ValidatableResponse and()  
    static io.restassured.specification.RequestSender andGiven()
    Add an additional clause to a RestAssured query
    static io.restassured.authentication.AuthenticationScheme basic​(java.lang.String userName, java.lang.String password)  
    static io.restassured.authentication.AuthenticationScheme certificate​(java.lang.String certURL, java.lang.String password)  
    static io.restassured.authentication.AuthenticationScheme certificate​(java.lang.String certURL, java.lang.String password, io.restassured.authentication.CertificateAuthSettings certificateAuthSettings)  
    static void clear()
    Clear the current RestAssured test context, so that the next when() call will create a new RestAssured query
    static io.restassured.config.RestAssuredConfig config()  
    static io.restassured.response.Response delete()  
    static io.restassured.response.Response delete​(java.lang.String path, java.lang.Object... pathParams)  
    static io.restassured.response.Response delete​(java.lang.String path, java.util.Map<java.lang.String,​?> pathParams)  
    static io.restassured.response.Response delete​(java.net.URI uri)  
    static io.restassured.response.Response delete​(java.net.URL url)  
    static io.restassured.authentication.AuthenticationScheme digest​(java.lang.String userName, java.lang.String password)  
    static io.restassured.config.LogConfig enableLoggingOfRequestAndResponseIfValidationFails()  
    static io.restassured.config.LogConfig enableLoggingOfRequestAndResponseIfValidationFails​(io.restassured.filter.log.LogDetail logDetail)  
    static io.restassured.specification.ResponseSpecification expect()  
    static java.util.List<io.restassured.filter.Filter> filters()  
    static java.util.List<io.restassured.filter.Filter> filters​(io.restassured.filter.Filter filter, io.restassured.filter.Filter... additionalFilters)  
    static java.util.List<io.restassured.filter.Filter> filters​(java.util.List<io.restassured.filter.Filter> filters)  
    static io.restassured.authentication.AuthenticationScheme form​(java.lang.String userName, java.lang.String password)  
    static io.restassured.authentication.AuthenticationScheme form​(java.lang.String userName, java.lang.String password, io.restassured.authentication.FormAuthConfig config)  
    static io.restassured.response.Response get()  
    static io.restassured.response.Response get​(java.lang.String path, java.lang.Object... pathParams)  
    static io.restassured.response.Response get​(java.lang.String path, java.util.Map<java.lang.String,​?> pathParams)  
    static io.restassured.response.Response get​(java.net.URI uri)  
    static io.restassured.response.Response get​(java.net.URL url)  
    static io.restassured.authentication.AuthenticationScheme getDefaultAuthentication()  
    static java.lang.String getDefaultBasePath()  
    static io.restassured.config.RestAssuredConfig getDefaultConfig()  
    static io.restassured.parsing.Parser getDefaultParser()  
    static int getDefaultPort()  
    static io.restassured.specification.ProxySpecification getDefaultProxy()  
    static io.restassured.specification.RequestSpecification getDefaultRequestSpecification()  
    static io.restassured.specification.ResponseSpecification getDefaultResponseSpecification()  
    static java.lang.String getDefaultRootPath()  
    static java.lang.String getDefaultSessionId()  
    static io.restassured.specification.RequestSpecification given()
    Create a new RestAssured query sequence
    static io.restassured.specification.RequestSpecification given​(io.restassured.specification.RequestSpecification requestSpecification)  
    static io.restassured.specification.RequestSender given​(io.restassured.specification.RequestSpecification request, io.restassured.specification.ResponseSpecification response)  
    static io.restassured.specification.RequestSpecification givenWithNoReporting()  
    static io.restassured.response.Response head()  
    static io.restassured.response.Response head​(java.lang.String path, java.lang.Object... pathParams)  
    static io.restassured.response.Response head​(java.lang.String path, java.util.Map<java.lang.String,​?> pathParams)  
    static io.restassured.response.Response head​(java.net.URI uri)  
    static io.restassured.response.Response head​(java.net.URL url)  
    static boolean isUrlEncodingEnabled()  
    static io.restassured.config.SSLConfig keystore​(java.io.File pathToJks, java.lang.String password)  
    static io.restassured.config.SSLConfig keystore​(java.lang.String password)  
    static io.restassured.config.SSLConfig keystore​(java.lang.String pathToJks, java.lang.String password)  
    static io.restassured.response.Response lastResponse()  
    static io.restassured.authentication.AuthenticationScheme oauth​(java.lang.String consumerKey, java.lang.String consumerSecret, java.lang.String accessToken, java.lang.String secretToken)  
    static io.restassured.authentication.AuthenticationScheme oauth​(java.lang.String consumerKey, java.lang.String consumerSecret, java.lang.String accessToken, java.lang.String secretToken, io.restassured.authentication.OAuthSignature signature)  
    static io.restassured.authentication.AuthenticationScheme oauth2​(java.lang.String accessToken)  
    static io.restassured.authentication.AuthenticationScheme oauth2​(java.lang.String accessToken, io.restassured.authentication.OAuthSignature signature)  
    static io.restassured.mapper.ObjectMapper objectMapper​(io.restassured.mapper.ObjectMapper objectMapper)  
    static io.restassured.response.Response options()  
    static io.restassured.response.Response options​(java.lang.String path, java.lang.Object... pathParams)  
    static io.restassured.response.Response options​(java.lang.String path, java.util.Map<java.lang.String,​?> pathParams)  
    static io.restassured.response.Response options​(java.net.URI uri)  
    static io.restassured.response.Response options​(java.net.URL url)  
    static io.restassured.response.Response patch()  
    static io.restassured.response.Response patch​(java.lang.String path, java.lang.Object... pathParams)  
    static io.restassured.response.Response patch​(java.lang.String path, java.util.Map<java.lang.String,​?> pathParams)  
    static io.restassured.response.Response patch​(java.net.URI uri)  
    static io.restassured.response.Response patch​(java.net.URL url)  
    static io.restassured.response.Response post()  
    static io.restassured.response.Response post​(java.lang.String path, java.lang.Object... pathParams)  
    static io.restassured.response.Response post​(java.lang.String path, java.util.Map<java.lang.String,​?> pathParams)  
    static io.restassured.response.Response post​(java.net.URI uri)  
    static io.restassured.response.Response post​(java.net.URL url)  
    static io.restassured.authentication.PreemptiveAuthProvider preemptive()  
    static io.restassured.specification.ProxySpecification proxy​(int port)  
    static io.restassured.specification.ProxySpecification proxy​(io.restassured.specification.ProxySpecification proxySpecification)  
    static io.restassured.specification.ProxySpecification proxy​(java.lang.String host)  
    static io.restassured.specification.ProxySpecification proxy​(java.lang.String host, int port)  
    static io.restassured.specification.ProxySpecification proxy​(java.lang.String host, int port, java.lang.String scheme)  
    static io.restassured.specification.ProxySpecification proxy​(java.net.URI uri)  
    static io.restassured.response.Response put()  
    static io.restassured.response.Response put​(java.lang.String path, java.lang.Object... pathParams)  
    static io.restassured.response.Response put​(java.net.URI uri)  
    static io.restassured.response.Response put​(java.net.URL url)  
    static void registerParser​(java.lang.String contentType, io.restassured.parsing.Parser parser)  
    static java.util.List<io.restassured.filter.Filter> replaceFiltersWith​(io.restassured.filter.Filter filter, io.restassured.filter.Filter... additionalFilters)  
    static java.util.List<io.restassured.filter.Filter> replaceFiltersWith​(java.util.List<io.restassured.filter.Filter> filters)  
    static void reset()  
    static io.restassured.specification.RequestSpecification rest()  
    static void restAssuredThat​(java.util.function.Consumer<io.restassured.response.ValidatableResponse> expectedCondition)
    A convenience method that allows you to check the last response received using a lambda expression, e.g.
    static io.restassured.authentication.AuthenticationScheme setDefaultAuthentication​(io.restassured.authentication.AuthenticationScheme authentication)  
    static java.lang.String setDefaultBasePath​(java.lang.String basePath)  
    static io.restassured.config.RestAssuredConfig setDefaultConfig​(io.restassured.config.RestAssuredConfig config)  
    static io.restassured.parsing.Parser setDefaultParser​(io.restassured.parsing.Parser defaultParser)  
    static int setDefaultPort​(int port)  
    static io.restassured.specification.ProxySpecification setDefaultProxy​(int port)  
    static io.restassured.specification.ProxySpecification setDefaultProxy​(io.restassured.specification.ProxySpecification proxy)  
    static io.restassured.specification.ProxySpecification setDefaultProxy​(java.lang.String host, int port)  
    static io.restassured.specification.ProxySpecification setDefaultProxy​(java.lang.String host, int port, java.lang.String scheme)  
    static io.restassured.specification.ProxySpecification setDefaultProxy​(java.net.URI uri)  
    static io.restassured.specification.RequestSpecification setDefaultRequestSpecification​(io.restassured.specification.RequestSpecification requestSpecification)  
    static io.restassured.specification.ResponseSpecification setDefaultResponseSpecification​(io.restassured.specification.ResponseSpecification responseSpecification)  
    static java.lang.String setDefaultRootPath​(java.lang.String rootPath)  
    static java.lang.String setDefaultSessionId​(java.lang.String sessionId)  
    static boolean setUrlEncodingEnabled​(boolean urlEncodingEnabled)  
    static io.restassured.response.ValidatableResponse then()  
    static io.restassured.config.SSLConfig trustStore​(java.security.KeyStore truststore)  
    static void unregisterParser​(java.lang.String contentType)  
    static io.restassured.config.SSLConfig useRelaxedHTTPSValidation()  
    static io.restassured.config.SSLConfig useRelaxedHTTPSValidation​(java.lang.String protocol)  
    static io.restassured.specification.RequestSender when()
    Add an action to a RestAssured query, building on previous given() statements if they were called.
    static io.restassured.specification.RequestSpecification with()  
    static java.util.List<io.restassured.specification.Argument> withArgs​(java.lang.Object firstArgument, java.lang.Object... additionalArguments)  
    static java.util.List<io.restassured.specification.Argument> withArguments​(java.lang.Object firstArgument, java.lang.Object... additionalArguments)  
    static java.util.List<io.restassured.specification.Argument> withNoArgs()  
    static java.util.List<io.restassured.specification.Argument> withNoArguments()  

    Methods inherited from class java.lang.Object

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

    • SerenityRest

      public SerenityRest()
  • Method Details

    • rest

      public static io.restassured.specification.RequestSpecification rest()
    • and

      public static io.restassured.response.ValidatableResponse and()
    • then

      public static io.restassured.response.ValidatableResponse then()
    • lastResponse

      public static io.restassured.response.Response lastResponse()
    • setDefaultBasePath

      public static java.lang.String setDefaultBasePath​(java.lang.String basePath)
    • getDefaultBasePath

      public static java.lang.String getDefaultBasePath()
    • getDefaultPort

      public static int getDefaultPort()
    • setDefaultPort

      public static int setDefaultPort​(int port)
    • isUrlEncodingEnabled

      public static boolean isUrlEncodingEnabled()
    • setUrlEncodingEnabled

      public static boolean setUrlEncodingEnabled​(boolean urlEncodingEnabled)
    • getDefaultRootPath

      public static java.lang.String getDefaultRootPath()
    • setDefaultRootPath

      public static java.lang.String setDefaultRootPath​(java.lang.String rootPath)
    • getDefaultSessionId

      public static java.lang.String getDefaultSessionId()
    • setDefaultSessionId

      public static java.lang.String setDefaultSessionId​(java.lang.String sessionId)
    • getDefaultAuthentication

      public static io.restassured.authentication.AuthenticationScheme getDefaultAuthentication()
    • setDefaultAuthentication

      public static io.restassured.authentication.AuthenticationScheme setDefaultAuthentication​(io.restassured.authentication.AuthenticationScheme authentication)
    • getDefaultRequestSpecification

      public static io.restassured.specification.RequestSpecification getDefaultRequestSpecification()
    • setDefaultRequestSpecification

      public static io.restassured.specification.RequestSpecification setDefaultRequestSpecification​(io.restassured.specification.RequestSpecification requestSpecification)
    • getDefaultParser

      public static io.restassured.parsing.Parser getDefaultParser()
    • setDefaultParser

      public static io.restassured.parsing.Parser setDefaultParser​(io.restassured.parsing.Parser defaultParser)
    • getDefaultResponseSpecification

      public static io.restassured.specification.ResponseSpecification getDefaultResponseSpecification()
    • setDefaultResponseSpecification

      public static io.restassured.specification.ResponseSpecification setDefaultResponseSpecification​(io.restassured.specification.ResponseSpecification responseSpecification)
    • reset

      public static void reset()
    • filters

      public static java.util.List<io.restassured.filter.Filter> filters​(java.util.List<io.restassured.filter.Filter> filters)
    • filters

      public static java.util.List<io.restassured.filter.Filter> filters​(io.restassured.filter.Filter filter, io.restassured.filter.Filter... additionalFilters)
    • replaceFiltersWith

      public static java.util.List<io.restassured.filter.Filter> replaceFiltersWith​(java.util.List<io.restassured.filter.Filter> filters)
    • replaceFiltersWith

      public static java.util.List<io.restassured.filter.Filter> replaceFiltersWith​(io.restassured.filter.Filter filter, io.restassured.filter.Filter... additionalFilters)
    • filters

      public static java.util.List<io.restassured.filter.Filter> filters()
    • objectMapper

      public static io.restassured.mapper.ObjectMapper objectMapper​(io.restassured.mapper.ObjectMapper objectMapper)
    • expect

      public static io.restassured.specification.ResponseSpecification expect()
    • with

      public static io.restassured.specification.RequestSpecification with()
    • withArguments

      public static java.util.List<io.restassured.specification.Argument> withArguments​(java.lang.Object firstArgument, java.lang.Object... additionalArguments)
    • withNoArguments

      public static java.util.List<io.restassured.specification.Argument> withNoArguments()
    • withArgs

      public static java.util.List<io.restassured.specification.Argument> withArgs​(java.lang.Object firstArgument, java.lang.Object... additionalArguments)
    • withNoArgs

      public static java.util.List<io.restassured.specification.Argument> withNoArgs()
    • given

      public static io.restassured.specification.RequestSpecification given()
      Create a new RestAssured query sequence
      Returns:
    • givenWithNoReporting

      public static io.restassured.specification.RequestSpecification givenWithNoReporting()
    • andGiven

      public static io.restassured.specification.RequestSender andGiven()
      Add an additional clause to a RestAssured query
      Returns:
    • clear

      public static void clear()
      Clear the current RestAssured test context, so that the next when() call will create a new RestAssured query
    • when

      public static io.restassured.specification.RequestSender when()
      Add an action to a RestAssured query, building on previous given() statements if they were called.
      Returns:
    • given

      public static io.restassured.specification.RequestSender given​(io.restassured.specification.RequestSpecification request, io.restassured.specification.ResponseSpecification response)
    • given

      public static io.restassured.specification.RequestSpecification given​(io.restassured.specification.RequestSpecification requestSpecification)
    • useRelaxedHTTPSValidation

      public static io.restassured.config.SSLConfig useRelaxedHTTPSValidation()
    • useRelaxedHTTPSValidation

      public static io.restassured.config.SSLConfig useRelaxedHTTPSValidation​(java.lang.String protocol)
    • registerParser

      public static void registerParser​(java.lang.String contentType, io.restassured.parsing.Parser parser)
    • unregisterParser

      public static void unregisterParser​(java.lang.String contentType)
    • oauth2

      public static io.restassured.authentication.AuthenticationScheme oauth2​(java.lang.String accessToken)
    • trustStore

      public static io.restassured.config.SSLConfig trustStore​(java.security.KeyStore truststore)
    • certificate

      public static io.restassured.authentication.AuthenticationScheme certificate​(java.lang.String certURL, java.lang.String password)
    • enableLoggingOfRequestAndResponseIfValidationFails

      public static io.restassured.config.LogConfig enableLoggingOfRequestAndResponseIfValidationFails()
    • enableLoggingOfRequestAndResponseIfValidationFails

      public static io.restassured.config.LogConfig enableLoggingOfRequestAndResponseIfValidationFails​(io.restassured.filter.log.LogDetail logDetail)
    • certificate

      public static io.restassured.authentication.AuthenticationScheme certificate​(java.lang.String certURL, java.lang.String password, io.restassured.authentication.CertificateAuthSettings certificateAuthSettings)
    • form

      public static io.restassured.authentication.AuthenticationScheme form​(java.lang.String userName, java.lang.String password)
    • preemptive

      public static io.restassured.authentication.PreemptiveAuthProvider preemptive()
    • form

      public static io.restassured.authentication.AuthenticationScheme form​(java.lang.String userName, java.lang.String password, io.restassured.authentication.FormAuthConfig config)
    • oauth2

      public static io.restassured.authentication.AuthenticationScheme oauth2​(java.lang.String accessToken, io.restassured.authentication.OAuthSignature signature)
    • basic

      public static io.restassured.authentication.AuthenticationScheme basic​(java.lang.String userName, java.lang.String password)
    • proxy

      public static io.restassured.specification.ProxySpecification proxy​(java.lang.String host, int port, java.lang.String scheme)
    • proxy

      public static io.restassured.specification.ProxySpecification proxy​(java.lang.String host, int port)
    • proxy

      public static io.restassured.specification.ProxySpecification proxy​(int port)
    • proxy

      public static io.restassured.specification.ProxySpecification proxy​(java.net.URI uri)
    • proxy

      public static io.restassured.specification.ProxySpecification proxy​(java.lang.String host)
    • proxy

      public static io.restassured.specification.ProxySpecification proxy​(io.restassured.specification.ProxySpecification proxySpecification)
    • setDefaultProxy

      public static io.restassured.specification.ProxySpecification setDefaultProxy​(java.lang.String host, int port, java.lang.String scheme)
    • setDefaultProxy

      public static io.restassured.specification.ProxySpecification setDefaultProxy​(io.restassured.specification.ProxySpecification proxy)
    • setDefaultProxy

      public static io.restassured.specification.ProxySpecification setDefaultProxy​(java.lang.String host, int port)
    • setDefaultProxy

      public static io.restassured.specification.ProxySpecification setDefaultProxy​(int port)
    • setDefaultProxy

      public static io.restassured.specification.ProxySpecification setDefaultProxy​(java.net.URI uri)
    • getDefaultProxy

      public static io.restassured.specification.ProxySpecification getDefaultProxy()
    • keystore

      public static io.restassured.config.SSLConfig keystore​(java.io.File pathToJks, java.lang.String password)
    • keystore

      public static io.restassured.config.SSLConfig keystore​(java.lang.String password)
    • keystore

      public static io.restassured.config.SSLConfig keystore​(java.lang.String pathToJks, java.lang.String password)
    • head

      public static io.restassured.response.Response head​(java.net.URI uri)
    • head

      public static io.restassured.response.Response head()
    • head

      public static io.restassured.response.Response head​(java.lang.String path, java.lang.Object... pathParams)
    • head

      public static io.restassured.response.Response head​(java.lang.String path, java.util.Map<java.lang.String,​?> pathParams)
    • head

      public static io.restassured.response.Response head​(java.net.URL url)
    • config

      public static io.restassured.config.RestAssuredConfig config()
    • getDefaultConfig

      public static io.restassured.config.RestAssuredConfig getDefaultConfig()
    • setDefaultConfig

      public static io.restassured.config.RestAssuredConfig setDefaultConfig​(io.restassured.config.RestAssuredConfig config)
    • oauth

      public static io.restassured.authentication.AuthenticationScheme oauth​(java.lang.String consumerKey, java.lang.String consumerSecret, java.lang.String accessToken, java.lang.String secretToken, io.restassured.authentication.OAuthSignature signature)
    • oauth

      public static io.restassured.authentication.AuthenticationScheme oauth​(java.lang.String consumerKey, java.lang.String consumerSecret, java.lang.String accessToken, java.lang.String secretToken)
    • digest

      public static io.restassured.authentication.AuthenticationScheme digest​(java.lang.String userName, java.lang.String password)
    • options

      public static io.restassured.response.Response options()
    • options

      public static io.restassured.response.Response options​(java.net.URL url)
    • options

      public static io.restassured.response.Response options​(java.net.URI uri)
    • options

      public static io.restassured.response.Response options​(java.lang.String path, java.lang.Object... pathParams)
    • options

      public static io.restassured.response.Response options​(java.lang.String path, java.util.Map<java.lang.String,​?> pathParams)
    • patch

      public static io.restassured.response.Response patch​(java.lang.String path, java.util.Map<java.lang.String,​?> pathParams)
    • patch

      public static io.restassured.response.Response patch​(java.net.URI uri)
    • patch

      public static io.restassured.response.Response patch​(java.net.URL url)
    • patch

      public static io.restassured.response.Response patch()
    • patch

      public static io.restassured.response.Response patch​(java.lang.String path, java.lang.Object... pathParams)
    • post

      public static io.restassured.response.Response post​(java.lang.String path, java.lang.Object... pathParams)
    • post

      public static io.restassured.response.Response post​(java.lang.String path, java.util.Map<java.lang.String,​?> pathParams)
    • post

      public static io.restassured.response.Response post​(java.net.URL url)
    • post

      public static io.restassured.response.Response post()
    • post

      public static io.restassured.response.Response post​(java.net.URI uri)
    • put

      public static io.restassured.response.Response put​(java.net.URI uri)
    • put

      public static io.restassured.response.Response put​(java.lang.String path, java.lang.Object... pathParams)
    • put

      public static io.restassured.response.Response put()
    • put

      public static io.restassured.response.Response put​(java.net.URL url)
    • delete

      public static io.restassured.response.Response delete​(java.lang.String path, java.util.Map<java.lang.String,​?> pathParams)
    • delete

      public static io.restassured.response.Response delete​(java.net.URL url)
    • delete

      public static io.restassured.response.Response delete​(java.net.URI uri)
    • delete

      public static io.restassured.response.Response delete()
    • delete

      public static io.restassured.response.Response delete​(java.lang.String path, java.lang.Object... pathParams)
    • get

      public static io.restassured.response.Response get​(java.net.URI uri)
    • get

      public static io.restassured.response.Response get​(java.net.URL url)
    • get

      public static io.restassured.response.Response get​(java.lang.String path, java.lang.Object... pathParams)
    • get

      public static io.restassured.response.Response get​(java.lang.String path, java.util.Map<java.lang.String,​?> pathParams)
    • get

      public static io.restassured.response.Response get()
    • restAssuredThat

      public static void restAssuredThat​(java.util.function.Consumer<io.restassured.response.ValidatableResponse> expectedCondition)
      A convenience method that allows you to check the last response received using a lambda expression, e.g. restAssuredThat(lastResponse -> lastResponse.body(equalTo(expectedMessage)));