package com.novoda.downloadmanager;

import java.util.Hashtable;
import java.util.Map;

class NetworkRequestFixtures {

    private Map<String, String> headers = new Hashtable<>();
    private String url = "http://www.google.com";
    private NetworkRequest.Method method = NetworkRequest.Method.GET;

    static NetworkRequestFixtures aNetworkRequest() {
        return new NetworkRequestFixtures();
    }

    NetworkRequestFixtures withHeader(String key, String value) {
        headers.put(key, value);
        return this;
    }

    NetworkRequestFixtures withUrl(String url) {
        this.url = url;
        return this;
    }

    NetworkRequestFixtures withMethod(NetworkRequest.Method method) {
        this.method = method;
        return this;
    }

    NetworkRequest build() {
        return new StubNetworkRequest(headers, url, method);
    }

    private static class StubNetworkRequest implements NetworkRequest {

        private final Map<String, String> headers;
        private final String url;
        private final Method method;

        private StubNetworkRequest(Map<String, String> headers, String url, Method method) {
            this.headers = headers;
            this.url = url;
            this.method = method;
        }

        @Override
        public Map<String, String> headers() {
            return headers;
        }

        @Override
        public String url() {
            return url;
        }

        @Override
        public Method method() {
            return method;
        }
    }
}

@@ -1526,16 +1526,651 @@
        %7D
+%0A%0A        @Override%0A        public boolean equals(Object o) %7B%0A            if (this == o) return true;%0A            if (!(o instanceof StubNetworkRequest)) return false;%0A%0A            StubNetworkRequest that = (StubNetworkRequest) o;%0A%0A            if (!headers.equals(that.headers)) return false;%0A            if (!url.equals(that.url)) return false;%0A            return method == that.method;%0A        %7D%0A%0A        @Override%0A        public int hashCode() %7B%0A            int result = headers.hashCode();%0A            result = 31 * result + url.hashCode();%0A            result = 31 * result + method.hashCode();%0A            return result;%0A        %7D
 %0A    %7D%0A%7D

add hash and equals