Class MockMvcConfig
java.lang.Object
io.restassured.module.mockmvc.config.MockMvcConfig
- All Implemented Interfaces:
io.restassured.config.Config,ClientConfig
General configuration of the Spring Mock MVC module
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a defaultMockMvcConfigthat automatically applies theSecurityMockMvcConfigurerif available in classpath. -
Method Summary
Modifier and TypeMethodDescriptionInstruct REST Assured Mock Mvc to automatically apply support forspring-restdocs-mockmvcif it's available in the classpath.automaticallyApplySpringRestDocsMockMvcSupport(boolean automaticallyApplySpringRestDocsMockMvcSupport) Instructs REST Assured whether or not to automatically supportspring-restdocs-mockmvcif available in classpath.Instruct REST Assured Mock Mvc to automatically apply the SpringSecurityMockMvcConfigurer if it's available in the classpath.automaticallyApplySpringSecurityMockMvcConfigurer(boolean shouldAutomaticallyApplySpringSecurityMockMvcConfigurer) Instructs REST Assured to automatically apply the SecurityMockMvcConfigurer that allows for Spring Security testing.Instruct REST Assured Mock Mvc not to automatically apply support forspring-restdocs-mockmvceven if it's available in the classpath.Instruct REST Assured Mock Mvc not to automatically apply the SpringSecurityMockMvcConfigurer even if it's available in the classpath.booleanstatic MockMvcConfigJust syntactic sugar.booleanbooleanwith()Just syntactic sugar to make the DSL more english like.
-
Constructor Details
-
MockMvcConfig
public MockMvcConfig()Creates a defaultMockMvcConfigthat automatically applies theSecurityMockMvcConfigurerif available in classpath.
-
-
Method Details
-
dontAutomaticallyApplySpringSecurityMockMvcConfigurer
Instruct REST Assured Mock Mvc not to automatically apply the SpringSecurityMockMvcConfigurer even if it's available in the classpath. -
dontAutomaticallyApplySpringRestDocsMockMvcSupport
Instruct REST Assured Mock Mvc not to automatically apply support forspring-restdocs-mockmvceven 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 ifspring-security-testis in the classpath and you've configured Rest Assured Mock MVC an instance ofAbstractMockMvcBuilder. For example by usingMockMvcRequestSpecification.webAppContextSetup(WebApplicationContext, MockMvcConfigurer...)orMockMvcRequestSpecification.standaloneSetup(MockMvcBuilder).- Parameters:
shouldAutomaticallyApplySpringSecurityMockMvcConfigurer-trueif SecurityMockMvcConfigurer should be automatically applied if available in classpath,falseotherwise.- Returns:
- a new instance of
MockMvcConfig.
-
automaticallyApplySpringRestDocsMockMvcSupport
public MockMvcConfig automaticallyApplySpringRestDocsMockMvcSupport(boolean automaticallyApplySpringRestDocsMockMvcSupport) Instructs REST Assured whether or not to automatically supportspring-restdocs-mockmvcif available in classpath.- Parameters:
automaticallyApplySpringRestDocsMockMvcSupport-trueif Spring Rest Docs MockMvc support should be automatically applied if available in classpath,falseotherwise.- Returns:
- a new instance of
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
Instruct REST Assured Mock Mvc to automatically apply support forspring-restdocs-mockmvcif 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-mockmvcif it's available in classpath
-
isUserConfigured
public boolean isUserConfigured()- Specified by:
isUserConfiguredin interfaceClientConfig- Specified by:
isUserConfiguredin interfaceio.restassured.config.Config
-
with
Just syntactic sugar to make the DSL more english like. -
mockMvcConfig
Just syntactic sugar.- Returns:
- A new instance of
MockMvcConfig.
-