Class SerenityRest


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

      Constructors 
      Constructor Description
      SerenityRest()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      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​(String userName, String password)  
      static io.restassured.authentication.AuthenticationScheme certificate​(String certURL, String password)  
      static io.restassured.authentication.AuthenticationScheme certificate​(String certURL, 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​(String path, Object... pathParams)  
      static io.restassured.response.Response delete​(String path, Map<String,​?> pathParams)  
      static io.restassured.response.Response delete​(URI uri)  
      static io.restassured.response.Response delete​(URL url)  
      static io.restassured.authentication.AuthenticationScheme digest​(String userName, 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 List<io.restassured.filter.Filter> filters()  
      static List<io.restassured.filter.Filter> filters​(io.restassured.filter.Filter filter, io.restassured.filter.Filter... additionalFilters)  
      static List<io.restassured.filter.Filter> filters​(List<io.restassured.filter.Filter> filters)  
      static io.restassured.authentication.AuthenticationScheme form​(String userName, String password)  
      static io.restassured.authentication.AuthenticationScheme form​(String userName, String password, io.restassured.authentication.FormAuthConfig config)  
      static io.restassured.response.Response get()  
      static io.restassured.response.Response get​(String path, Object... pathParams)  
      static io.restassured.response.Response get​(String path, Map<String,​?> pathParams)  
      static io.restassured.response.Response get​(URI uri)  
      static io.restassured.response.Response get​(URL url)  
      static io.restassured.authentication.AuthenticationScheme getDefaultAuthentication()  
      static 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 String getDefaultRootPath()  
      static 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​(String path, Object... pathParams)  
      static io.restassured.response.Response head​(String path, Map<String,​?> pathParams)  
      static io.restassured.response.Response head​(URI uri)  
      static io.restassured.response.Response head​(URL url)  
      static boolean isUrlEncodingEnabled()  
      static io.restassured.config.SSLConfig keystore​(File pathToJks, String password)  
      static io.restassured.config.SSLConfig keystore​(String password)  
      static io.restassured.config.SSLConfig keystore​(String pathToJks, String password)  
      static io.restassured.response.Response lastResponse()  
      static io.restassured.authentication.AuthenticationScheme oauth​(String consumerKey, String consumerSecret, String accessToken, String secretToken)  
      static io.restassured.authentication.AuthenticationScheme oauth​(String consumerKey, String consumerSecret, String accessToken, String secretToken, io.restassured.authentication.OAuthSignature signature)  
      static io.restassured.authentication.AuthenticationScheme oauth2​(String accessToken)  
      static io.restassured.authentication.AuthenticationScheme oauth2​(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​(String path, Object... pathParams)  
      static io.restassured.response.Response options​(String path, Map<String,​?> pathParams)  
      static io.restassured.response.Response options​(URI uri)  
      static io.restassured.response.Response options​(URL url)  
      static io.restassured.response.Response patch()  
      static io.restassured.response.Response patch​(String path, Object... pathParams)  
      static io.restassured.response.Response patch​(String path, Map<String,​?> pathParams)  
      static io.restassured.response.Response patch​(URI uri)  
      static io.restassured.response.Response patch​(URL url)  
      static io.restassured.response.Response post()  
      static io.restassured.response.Response post​(String path, Object... pathParams)  
      static io.restassured.response.Response post​(String path, Map<String,​?> pathParams)  
      static io.restassured.response.Response post​(URI uri)  
      static io.restassured.response.Response post​(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​(String host)  
      static io.restassured.specification.ProxySpecification proxy​(String host, int port)  
      static io.restassured.specification.ProxySpecification proxy​(String host, int port, String scheme)  
      static io.restassured.specification.ProxySpecification proxy​(URI uri)  
      static io.restassured.response.Response put()  
      static io.restassured.response.Response put​(String path, Object... pathParams)  
      static io.restassured.response.Response put​(URI uri)  
      static io.restassured.response.Response put​(URL url)  
      static void registerParser​(String contentType, io.restassured.parsing.Parser parser)  
      static List<io.restassured.filter.Filter> replaceFiltersWith​(io.restassured.filter.Filter filter, io.restassured.filter.Filter... additionalFilters)  
      static List<io.restassured.filter.Filter> replaceFiltersWith​(List<io.restassured.filter.Filter> filters)  
      static void reset()  
      static io.restassured.specification.RequestSpecification rest()  
      static void restAssuredThat​(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 String setDefaultBasePath​(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​(String host, int port)  
      static io.restassured.specification.ProxySpecification setDefaultProxy​(String host, int port, String scheme)  
      static io.restassured.specification.ProxySpecification setDefaultProxy​(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 String setDefaultRootPath​(String rootPath)  
      static String setDefaultSessionId​(String sessionId)  
      static boolean setUrlEncodingEnabled​(boolean urlEncodingEnabled)  
      static io.restassured.response.ValidatableResponse then()  
      static io.restassured.config.SSLConfig trustStore​(KeyStore truststore)  
      static void unregisterParser​(String contentType)  
      static io.restassured.config.SSLConfig useRelaxedHTTPSValidation()  
      static io.restassured.config.SSLConfig useRelaxedHTTPSValidation​(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 List<io.restassured.specification.Argument> withArgs​(Object firstArgument, Object... additionalArguments)  
      static List<io.restassured.specification.Argument> withArguments​(Object firstArgument, Object... additionalArguments)  
      static List<io.restassured.specification.Argument> withNoArgs()  
      static List<io.restassured.specification.Argument> withNoArguments()  
    • Constructor Detail

      • SerenityRest

        public SerenityRest()
    • Method Detail

      • 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 String setDefaultBasePath​(String basePath)
      • getDefaultBasePath

        public static 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 String getDefaultRootPath()
      • setDefaultRootPath

        public static String setDefaultRootPath​(String rootPath)
      • getDefaultSessionId

        public static String getDefaultSessionId()
      • setDefaultSessionId

        public static String setDefaultSessionId​(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 List<io.restassured.filter.Filter> filters​(List<io.restassured.filter.Filter> filters)
      • filters

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

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

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

        public static 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 List<io.restassured.specification.Argument> withArguments​(Object firstArgument,
                                                                                Object... additionalArguments)
      • withNoArguments

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

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

        public static 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​(String protocol)
      • registerParser

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

        public static void unregisterParser​(String contentType)
      • oauth2

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

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

        public static io.restassured.authentication.AuthenticationScheme certificate​(String certURL,
                                                                                     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​(String certURL,
                                                                                     String password,
                                                                                     io.restassured.authentication.CertificateAuthSettings certificateAuthSettings)
      • form

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        public static io.restassured.response.Response head​(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​(String consumerKey,
                                                                               String consumerSecret,
                                                                               String accessToken,
                                                                               String secretToken,
                                                                               io.restassured.authentication.OAuthSignature signature)
      • oauth

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        public static void restAssuredThat​(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)));