Search in sources :

Example 1 with AsyncConfig

use of io.restassured.module.mockmvc.config.AsyncConfig in project rest-assured by rest-assured.

the class MockMvcRequestSpecificationImpl method spec.

public MockMvcRequestSpecification spec(MockMvcRequestSpecification requestSpecificationToMerge) {
    notNull(requestSpecificationToMerge, MockMvcRequestSpecification.class);
    if (!(requestSpecificationToMerge instanceof MockMvcRequestSpecificationImpl)) {
        throw new IllegalArgumentException("requestSpecificationToMerge must be an instance of " + MockMvcRequestSpecificationImpl.class.getName());
    }
    MockMvcRequestSpecificationImpl that = (MockMvcRequestSpecificationImpl) requestSpecificationToMerge;
    Object otherRequestBody = that.getRequestBody();
    if (otherRequestBody != null) {
        this.requestBody = otherRequestBody;
    }
    if (isNotEmpty(that.getBasePath())) {
        this.basePath = that.getBasePath();
    }
    MockMvcFactory otherMockMvcFactory = that.getMockMvcFactory();
    if (otherMockMvcFactory != null && otherMockMvcFactory.isAssigned()) {
        this.changeMockMvcFactoryTo(otherMockMvcFactory);
    }
    this.cookies(that.getCookies());
    this.headers(that.getRequestHeaders());
    mergeConfig(this, that);
    MockHttpServletRequestBuilderInterceptor otherInterceptor = that.getInterceptor();
    if (otherInterceptor != null) {
        this.interceptor = otherInterceptor;
    }
    this.formParams(that.getFormParams());
    this.queryParams(that.getQueryParams());
    this.params(that.getParams());
    this.attributes(that.getAttributes());
    this.multiParts.addAll(that.getMultiParts());
    this.resultHandlers.addAll(that.getResultHandlers());
    this.requestPostProcessors.addAll(that.getRequestPostProcessors());
    RequestLoggingFilter otherRequestLoggingFilter = that.getRequestLoggingFilter();
    if (otherRequestLoggingFilter != null) {
        this.requestLoggingFilter = otherRequestLoggingFilter;
    }
    Object otherAuth = that.getAuthentication();
    if (otherAuth != null) {
        this.authentication = otherAuth;
    }
    AsyncConfig otherAsyncConfig = that.getAsyncConfig();
    if (otherAsyncConfig != null) {
        this.asyncConfig = otherAsyncConfig;
    }
    return this;
}
Also used : MockHttpServletRequestBuilderInterceptor(io.restassured.module.mockmvc.intercept.MockHttpServletRequestBuilderInterceptor) AsyncConfig(io.restassured.module.mockmvc.config.AsyncConfig) RequestLoggingFilter(io.restassured.filter.log.RequestLoggingFilter)

Aggregations

RequestLoggingFilter (io.restassured.filter.log.RequestLoggingFilter)1 AsyncConfig (io.restassured.module.mockmvc.config.AsyncConfig)1 MockHttpServletRequestBuilderInterceptor (io.restassured.module.mockmvc.intercept.MockHttpServletRequestBuilderInterceptor)1