All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jayway.restassured.internal.SpecificationMerger.groovy Maven / Gradle / Ivy

There is a newer version: 2.9.0
Show newest version
/*
 * Copyright 2011 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.jayway.restassured.internal

import static com.jayway.restassured.assertion.AssertParameter.notNull

class SpecificationMerger {

  /**
   * Merge this builder with settings from another specification. Note that the supplied specification
   * can overwrite data in the current specification. The following settings are overwritten:
   * 
    *
  • Content type
  • *
  • Root pathStatus code
  • *
  • Status line
  • *
* The following settings are merged: *
    *
  • Response body expectations
  • *
  • Cookies
  • *
  • Headers
  • *
*/ def static void merge(ResponseSpecificationImpl thisOne, ResponseSpecificationImpl with) { notNull thisOne, "Specification to merge" notNull with, "Specification to merge with" thisOne.contentType = with.contentType thisOne.bodyMatchers << with.bodyMatchers thisOne.bodyRootPath = with.bodyRootPath thisOne.cookieAssertions.addAll(with.cookieAssertions) thisOne.expectedStatusCode = with.expectedStatusCode thisOne.expectedStatusLine = with.expectedStatusLine thisOne.headerAssertions.addAll(with.headerAssertions) } /** * Merge this builder with settings from another specification. Note that the supplied specification * can overwrite data in the current specification. The following settings are overwritten: *
    *
  • Port
  • *
  • Authentication schemeContent type
  • *
  • Request body
  • *
* The following settings are merged: *
    *
  • Parameters
  • *
  • Query Parameters
  • *
  • Cookies
  • *
  • Headers
  • *
  • Filters
  • *
*/ def static void merge(RequestSpecificationImpl thisOne, RequestSpecificationImpl with) { thisOne.port = with.port thisOne.requestParameters.putAll(with.requestParameters) thisOne.queryParams.putAll(with.queryParams) thisOne.authenticationScheme = with.authenticationScheme thisOne.contentType = with.contentType thisOne.requestHeaders.putAll(with.requestHeaders) thisOne.cookies.putAll(with.cookies) thisOne.requestBody = with.requestBody thisOne.filters.addAll(with.filters) } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy