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

bdi.glue.http.httpclient.HttpClientHooks Maven / Gradle / Ivy

package bdi.glue.http.httpclient;

import bdi.glue.http.common.HttpResponse;
import bdi.glue.http.common.HttpWorld;
import cucumber.api.java.After;
import cucumber.api.java.Before;

/**
 * @author @aloyer
 */
public class HttpClientHooks {

    private final HttpClientWorld httpClientWorld;
    private final HttpWorld bdiWorld;

    public HttpClientHooks(HttpClientWorld httpClientWorld, HttpWorld bdiWorld) {
        this.httpClientWorld = httpClientWorld;
        this.bdiWorld = bdiWorld;
    }

    @Before(order = 1000)
    public void initHttpGateway() {
        HttpClientGateway httpGateway = new HttpClientGateway(httpClientWorld);
        bdiWorld.defineHttpGateway(httpGateway);
    }

    @After(order = 1000)
    public void tearDown() {
        HttpResponse response = bdiWorld.lastResponse();
        if (response != null)
            response.dispose();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy