Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 942 Bytes

rest-assured.md

File metadata and controls

40 lines (31 loc) · 942 Bytes

REST Assured Snippets

http://rest-assured.io

import static io.restassured.RestAssured.*;

import io.restassured.builder.RequestSpecBuilder;
import io.restassured.specification.*;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

public class RestAssuredTriesTest {

    private static RequestSpecification requestSpec;

    @BeforeAll
    public static void createRequestSpecification() {

        requestSpec = new RequestSpecBuilder().
                setBaseUri("https://finologee.com").
                build();
    }

    @Test
    public void requestContactPage() {

        String responseString = given().
                spec(requestSpec).
                when().
                get("/contact/").
                then().
                assertThat().
                statusCode(200)
                .extract()
                .asString();

        System.out.println(responseString);
    }
}