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

com.thoughtworks.webstub.dsl.builders.RequestBuilder Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
package com.thoughtworks.webstub.dsl.builders;

import com.thoughtworks.webstub.config.ConfigurationProvider;
import com.thoughtworks.webstub.config.HttpConfiguration;
import com.thoughtworks.webstub.config.Request;
import com.thoughtworks.webstub.config.Header;

import java.util.ArrayList;
import java.util.Collection;

public class RequestBuilder {
    private ConfigurationProvider configurationProvider;
    protected String uri;
    protected String method;
    protected Collection
headers = new ArrayList
(); public RequestBuilder(ConfigurationProvider configurationProvider) { this.configurationProvider = configurationProvider; } public T withMethod(String method) { this.method = method; return (T) this; } public T withUri(String uri) { this.uri = uri; return (T) this; } public T withHeader(String name, String value) { headers.add(new Header(name, value)); return (T) this; } protected Request build() { return new Request(method, uri, null, headers); } public final void returns(ResponseBuilder responseBuilder) { configurationProvider.configurationCreated(new HttpConfiguration(this.build(), responseBuilder.build())); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy