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

Java.libraries.rest-assured.ResponseSpecBuilders.mustache Maven / Gradle / Ivy

There is a newer version: 0.9.25
Show newest version
{{>licenseInfo}}

package {{invokerPackage}};

import io.restassured.builder.ResponseSpecBuilder;
import io.restassured.response.Response;
import io.restassured.specification.ResponseSpecification;

import java.util.function.Function;

public class ResponseSpecBuilders {

    private ResponseSpecBuilders() {
    }

    public static Function validatedWith(ResponseSpecification respSpec) {
        return response -> response.then().spec(respSpec).extract().response();
    }

    public static Function validatedWith(ResponseSpecBuilder respSpec) {
        return validatedWith(respSpec.build());
    }

    /**
     * @param code expected status code
     * @return ResponseSpecBuilder
     */
    public static ResponseSpecBuilder shouldBeCode(int code) {
        return new ResponseSpecBuilder().expectStatusCode(code);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy