Class MockMvcConfig

java.lang.Object
io.restassured.module.mockmvc.config.MockMvcConfig
All Implemented Interfaces:
io.restassured.config.Config, ClientConfig

public class MockMvcConfig extends Object implements ClientConfig, io.restassured.config.Config
General configuration of the Spring Mock MVC module
  • Constructor Details

    • MockMvcConfig

      public MockMvcConfig()
      Creates a default MockMvcConfig that automatically applies the SecurityMockMvcConfigurer if available in classpath.
  • Method Details

    • dontAutomaticallyApplySpringSecurityMockMvcConfigurer

      public MockMvcConfig dontAutomaticallyApplySpringSecurityMockMvcConfigurer()
      Instruct REST Assured Mock Mvc not to automatically apply the SpringSecurityMockMvcConfigurer even if it's available in the classpath.
    • dontAutomaticallyApplySpringRestDocsMockMvcSupport

      public MockMvcConfig dontAutomaticallyApplySpringRestDocsMockMvcSupport()
      Instruct REST Assured Mock Mvc not to automatically apply support for spring-restdocs-mockmvc even if it's available in the classpath.
    • automaticallyApplySpringSecurityMockMvcConfigurer

      public MockMvcConfig automaticallyApplySpringSecurityMockMvcConfigurer(boolean shouldAutomaticallyApplySpringSecurityMockMvcConfigurer)
      Instructs REST Assured to automatically apply the SecurityMockMvcConfigurer that allows for Spring Security testing. This only works if spring-security-test is in the classpath and you've configured Rest Assured Mock MVC an instance of AbstractMockMvcBuilder. For example by using MockMvcRequestSpecification.webAppContextSetup(WebApplicationContext, MockMvcConfigurer...) or MockMvcRequestSpecification.standaloneSetup(MockMvcBuilder).
      Parameters:
      shouldAutomaticallyApplySpringSecurityMockMvcConfigurer - true if SecurityMockMvcConfigurer should be automatically applied if available in classpath, false otherwise.
      Returns:
      a new instance of MockMvcConfig.
    • automaticallyApplySpringRestDocsMockMvcSupport

      public MockMvcConfig automaticallyApplySpringRestDocsMockMvcSupport(boolean automaticallyApplySpringRestDocsMockMvcSupport)
      Instructs REST Assured whether or not to automatically support spring-restdocs-mockmvc if available in classpath.
      Parameters:
      automaticallyApplySpringRestDocsMockMvcSupport - true if Spring Rest Docs MockMvc support should be automatically applied if available in classpath, false otherwise.
      Returns:
      a new instance of MockMvcConfig.
    • automaticallyApplySpringSecurityMockMvcConfigurer

      public MockMvcConfig automaticallyApplySpringSecurityMockMvcConfigurer()
      Instruct REST Assured Mock Mvc to automatically apply the SpringSecurityMockMvcConfigurer if it's available in the classpath.
      Returns:
      a new instance of MockMvcConfig.
      See Also:
    • automaticallyApplySpringRestDocsMockMvcSupport

      public MockMvcConfig automaticallyApplySpringRestDocsMockMvcSupport()
      Instruct REST Assured Mock Mvc to automatically apply support for spring-restdocs-mockmvc if it's available in the classpath.
      Returns:
      a new instance of MockMvcConfig.
      See Also:
    • shouldAutomaticallyApplySpringSecurityMockMvcConfigurer

      public boolean shouldAutomaticallyApplySpringSecurityMockMvcConfigurer()
      Returns:
      whether or not REST Assured should automatically try to apply support for Spring Security test if it's available in classpath
    • shouldAutomaticallyApplySpringRestDocsMockMvcSupport

      public boolean shouldAutomaticallyApplySpringRestDocsMockMvcSupport()
      Returns:
      whether or not REST Assured should automatically try to apply support for spring-restdocs-mockmvc if it's available in classpath
    • isUserConfigured

      public boolean isUserConfigured()
      Specified by:
      isUserConfigured in interface ClientConfig
      Specified by:
      isUserConfigured in interface io.restassured.config.Config
    • with

      public MockMvcConfig with()
      Just syntactic sugar to make the DSL more english like.
    • mockMvcConfig

      public static MockMvcConfig mockMvcConfig()
      Just syntactic sugar.
      Returns:
      A new instance of MockMvcConfig.