// Path: clients/java/src/org/httpmock/StubRequest.java
// public class StubRequest {
//     private final JSONObject data;
// 
//     public StubRequest(JSONObject data) {
//         this.data = data;
//     }
// 
//     public String getRequestMethod() {
//         return data.getString("method");
//     }
//     
//     public String getPath() {
//         return data.getString("path");
//     }
// 
//     public Map<String, String> getHeaders() {
//         Map<String, String> result = new HashMap<String, String>();
//         JSONObject headers = data.getJSONObject("headers");
//         Iterator iterator = headers.keys();
//         while (iterator.hasNext()) {
//             String header = (String) iterator.next();
//             result.put(header, headers.getString(header));
//         }
//         return result;
//     }
// 
//     public String getBody() {
//         return data.getString("body");
//     }
// }


import org.httpmock.StubRequest;
import java.util.HashMap;
import java.util.Map;
package org.httpmock.matchers;



public class Expectation {
    private final String requestMethod;
    private final String path;
    private final Map<String, String> expectedHeaders = new HashMap<String, String>();
    private String body;
    private String bodySubstring;

    public Expectation(String requestMethod, String path) {
        this.requestMethod = requestMethod;
        this.path = path;
    }

    public void addHeader(String key, String value) {
        expectedHeaders.put(key, value);
    }

    public void matchBody(String body) {
        this.body = body;
    }

    public void matchBodySubstring(String text) {
        bodySubstring = text;
    }

    public String getRequestMethod() {
        return requestMethod;
    }

    public String getPath() {
        return path;
    }

    public Map<String, String> getHeaders() {
        return expectedHeaders;
    }

// Path: clients/java/src/org/httpmock/StubRequest.java
// public class StubRequest {
//     private final JSONObject data;
// 
//     public StubRequest(JSONObject data) {
//         this.data = data;
//     }
// 
//     public String getRequestMethod() {
//         return data.getString("method");
//     }
//     
//     public String getPath() {
//         return data.getString("path");
//     }
// 
//     public Map<String, String> getHeaders() {
//         Map<String, String> result = new HashMap<String, String>();
//         JSONObject headers = data.getJSONObject("headers");
//         Iterator iterator = headers.keys();
//         while (iterator.hasNext()) {
//             String header = (String) iterator.next();
//             result.put(header, headers.getString(header));
//         }
//         return result;
//     }
// 
//     public String getBody() {
//         return data.getString("body");
//     }
// }


// Path: clients/java/src/org/httpmock/matchers/Expectation.java
import org.httpmock.StubRequest;
import java.util.HashMap;
import java.util.Map;

package org.httpmock.matchers;



public class Expectation {
    private final String requestMethod;
    private final String path;
    private final Map<String, String> expectedHeaders = new HashMap<String, String>();
    private String body;
    private String bodySubstring;

    public Expectation(String requestMethod, String path) {
        this.requestMethod = requestMethod;
        this.path = path;
    }

    public void addHeader(String key, String value) {
        expectedHeaders.put(key, value);
    }

    public void matchBody(String body) {
        this.body = body;
    }

    public void matchBodySubstring(String text) {
        bodySubstring = text;
    }

    public String getRequestMethod() {
        return requestMethod;
    }

    public String getPath() {
        return path;
    }

    public Map<String, String> getHeaders() {
        return expectedHeaders;
    }

    public boolean matches(StubRequest request) {