// Path: functional-test/src/main/java/au/com/sensis/stubby/test/model/JsonExchange.java
// public class JsonExchange {
// 
//     public JsonRequest request;
//     public JsonResponse response;
//     public Long delay;
//     public String script;
//     
//     @JsonIgnore
//     public JsonRequest request() {
//         if (request == null) {
//             request = new JsonRequest();
//         }
//         return request;
//     }
//     
//     @JsonIgnore
//     public JsonResponse response() {
//         if (response == null) {
//             response = new JsonResponse();
//         }
//         return response;
//     }
//     
// }
// 
// Path: functional-test/src/main/java/au/com/sensis/stubby/test/model/JsonRequest.java
// public class JsonRequest extends JsonMessage {
// 
//     public String method;
//     public String path;
//     public JsonPairList params;
//     
//     public void setParam(String name, String value) {
//         if (params == null) {
//             params = new JsonPairList();
//         }
//         params.set(name, value);
//     }
// 
//     public void addParam(String name, String value) {
//         if (params == null) {
//             params = new JsonPairList();
//         }
//         params.add(name, value);
//     }
//     
// }
// 
// Path: functional-test/src/main/java/au/com/sensis/stubby/test/model/JsonRequestList.java
// @SuppressWarnings("serial")
// public class JsonRequestList extends ArrayList<JsonRequest> {
//     
// }
// 
// Path: functional-test/src/main/java/au/com/sensis/stubby/test/model/JsonStubbedExchange.java
// public class JsonStubbedExchange {
// 
//     public JsonExchange exchange;
//     public List<Object> attempts; // TODO: lock-down the format of this...
//     
// }
// 
// Path: functional-test/src/main/java/au/com/sensis/stubby/test/model/JsonStubbedExchangeList.java
// @SuppressWarnings("serial")
// public class JsonStubbedExchangeList extends ArrayList<JsonStubbedExchange> {
//     
// }
// 
// Path: core/src/main/java/au/com/sensis/stubby/utils/JsonUtils.java
// public class JsonUtils {
//     
//     public static ObjectMapper mapper() {
//         return new ObjectMapper();
//     }
//     
//     public static ObjectMapper defaultMapper() {
//         ObjectMapper result = mapper();
//         result.enable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES);
//         result.enable(DeserializationConfig.Feature.USE_BIG_DECIMAL_FOR_FLOATS); // for 'exact' floating-point matches
//         result.setSerializationInclusion(Inclusion.NON_NULL);
//         return result;
//     }
//     
//     public static ObjectWriter prettyWriter() {
//         return defaultMapper().writerWithDefaultPrettyPrinter();
//     }
//     
//     public static String prettyPrint(Object value) {
//         try {
//             return prettyWriter().writeValueAsString(value); 
//         } catch (IOException e) {
//             throw new RuntimeException("Error serializing JSON", e);
//         }
//     }
// 
//     public static String serialize(Object object) {
//         try {
//             return defaultMapper().writeValueAsString(object);
//         } catch (IOException e) {
//             throw new RuntimeException("Error serializing JSON", e);
//         }
//     }
//     
//     public static void serialize(OutputStream stream, Object object) {
//         try {
//             defaultMapper().writeValue(stream, object);
//         } catch (IOException e) {
//             throw new RuntimeException("Error serializing JSON", e);
//         }
//     }
// 
//     public static <T> T deserialize(String json, Class<T> type) {
//         try {
//             return defaultMapper().readValue(json, type);
//         } catch (IOException e) {
//             throw new RuntimeException("Error deserializing JSON", e);
//         }
//     }
//     
//     public static <T> T deserialize(InputStream stream, Class<T> type) {
//         try {
//             return defaultMapper().readValue(stream, type);
//         } catch (IOException e) {
//             throw new RuntimeException("Error deserializing JSON", e);
//         }
//     }
//     
// }


import org.apache.http.entity.ContentType;
import au.com.sensis.stubby.test.model.JsonExchange;
import au.com.sensis.stubby.test.model.JsonRequest;
import au.com.sensis.stubby.test.model.JsonRequestList;
import au.com.sensis.stubby.test.model.JsonStubbedExchange;
import au.com.sensis.stubby.test.model.JsonStubbedExchangeList;
import au.com.sensis.stubby.utils.JsonUtils;
package au.com.sensis.stubby.test.client;



public class Client extends GenericClient {

    public Client(String baseUri) {
        super(baseUri);
    }

    public void postMessage(JsonExchange message) {
        executePost("/_control/responses", JsonUtils.serialize(message), ContentType.APPLICATION_JSON).assertOk();
    }

    public void postMessage(String message) {
        executePost("/_control/responses", message, ContentType.APPLICATION_JSON).assertOk();
    }

// Path: functional-test/src/main/java/au/com/sensis/stubby/test/model/JsonExchange.java
// public class JsonExchange {
// 
//     public JsonRequest request;
//     public JsonResponse response;
//     public Long delay;
//     public String script;
//     
//     @JsonIgnore
//     public JsonRequest request() {
//         if (request == null) {
//             request = new JsonRequest();
//         }
//         return request;
//     }
//     
//     @JsonIgnore
//     public JsonResponse response() {
//         if (response == null) {
//             response = new JsonResponse();
//         }
//         return response;
//     }
//     
// }
// 
// Path: functional-test/src/main/java/au/com/sensis/stubby/test/model/JsonRequest.java
// public class JsonRequest extends JsonMessage {
// 
//     public String method;
//     public String path;
//     public JsonPairList params;
//     
//     public void setParam(String name, String value) {
//         if (params == null) {
//             params = new JsonPairList();
//         }
//         params.set(name, value);
//     }
// 
//     public void addParam(String name, String value) {
//         if (params == null) {
//             params = new JsonPairList();
//         }
//         params.add(name, value);
//     }
//     
// }
// 
// Path: functional-test/src/main/java/au/com/sensis/stubby/test/model/JsonRequestList.java
// @SuppressWarnings("serial")
// public class JsonRequestList extends ArrayList<JsonRequest> {
//     
// }
// 
// Path: functional-test/src/main/java/au/com/sensis/stubby/test/model/JsonStubbedExchange.java
// public class JsonStubbedExchange {
// 
//     public JsonExchange exchange;
//     public List<Object> attempts; // TODO: lock-down the format of this...
//     
// }
// 
// Path: functional-test/src/main/java/au/com/sensis/stubby/test/model/JsonStubbedExchangeList.java
// @SuppressWarnings("serial")
// public class JsonStubbedExchangeList extends ArrayList<JsonStubbedExchange> {
//     
// }
// 
// Path: core/src/main/java/au/com/sensis/stubby/utils/JsonUtils.java
// public class JsonUtils {
//     
//     public static ObjectMapper mapper() {
//         return new ObjectMapper();
//     }
//     
//     public static ObjectMapper defaultMapper() {
//         ObjectMapper result = mapper();
//         result.enable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES);
//         result.enable(DeserializationConfig.Feature.USE_BIG_DECIMAL_FOR_FLOATS); // for 'exact' floating-point matches
//         result.setSerializationInclusion(Inclusion.NON_NULL);
//         return result;
//     }
//     
//     public static ObjectWriter prettyWriter() {
//         return defaultMapper().writerWithDefaultPrettyPrinter();
//     }
//     
//     public static String prettyPrint(Object value) {
//         try {
//             return prettyWriter().writeValueAsString(value); 
//         } catch (IOException e) {
//             throw new RuntimeException("Error serializing JSON", e);
//         }
//     }
// 
//     public static String serialize(Object object) {
//         try {
//             return defaultMapper().writeValueAsString(object);
//         } catch (IOException e) {
//             throw new RuntimeException("Error serializing JSON", e);
//         }
//     }
//     
//     public static void serialize(OutputStream stream, Object object) {
//         try {
//             defaultMapper().writeValue(stream, object);
//         } catch (IOException e) {
//             throw new RuntimeException("Error serializing JSON", e);
//         }
//     }
// 
//     public static <T> T deserialize(String json, Class<T> type) {
//         try {
//             return defaultMapper().readValue(json, type);
//         } catch (IOException e) {
//             throw new RuntimeException("Error deserializing JSON", e);
//         }
//     }
//     
//     public static <T> T deserialize(InputStream stream, Class<T> type) {
//         try {
//             return defaultMapper().readValue(stream, type);
//         } catch (IOException e) {
//             throw new RuntimeException("Error deserializing JSON", e);
//         }
//     }
//     
// }


// Path: functional-test/src/main/java/au/com/sensis/stubby/test/client/Client.java
import org.apache.http.entity.ContentType;
import au.com.sensis.stubby.test.model.JsonExchange;
import au.com.sensis.stubby.test.model.JsonRequest;
import au.com.sensis.stubby.test.model.JsonRequestList;
import au.com.sensis.stubby.test.model.JsonStubbedExchange;
import au.com.sensis.stubby.test.model.JsonStubbedExchangeList;
import au.com.sensis.stubby.utils.JsonUtils;

package au.com.sensis.stubby.test.client;



public class Client extends GenericClient {

    public Client(String baseUri) {
        super(baseUri);
    }

    public void postMessage(JsonExchange message) {
        executePost("/_control/responses", JsonUtils.serialize(message), ContentType.APPLICATION_JSON).assertOk();
    }

    public void postMessage(String message) {
        executePost("/_control/responses", message, ContentType.APPLICATION_JSON).assertOk();
    }

    public JsonStubbedExchangeList getResponses() {