// 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 java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.util.EntityUtils;
import au.com.sensis.stubby.utils.JsonUtils;
    }
    
    public List<String> getHeaders(String name) {
        List<String> result = new ArrayList<String>();
        for (Header header : response.getHeaders(name)) {
            result.add(header.getValue());
        }
        return result;
    }

    public GenericClientResponse assertOk() {
        if (!isOk()) {
            throw new RuntimeException("Server returned " + getStatus());
        }
        return this;
    }
    
    public GenericClientResponse assertBody() {
        if (!hasBody()) {
            throw new RuntimeException("Response body expected");
        }
        return this;
    }

    public boolean isOk() {
        return getStatus() == HttpStatus.SC_OK;
    }

    public <T> T getJson(Class<T> type) {
        assertBody();
// 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/GenericClientResponse.java
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.util.EntityUtils;
import au.com.sensis.stubby.utils.JsonUtils;

    }
    
    public List<String> getHeaders(String name) {
        List<String> result = new ArrayList<String>();
        for (Header header : response.getHeaders(name)) {
            result.add(header.getValue());
        }
        return result;
    }

    public GenericClientResponse assertOk() {
        if (!isOk()) {
            throw new RuntimeException("Server returned " + getStatus());
        }
        return this;
    }
    
    public GenericClientResponse assertBody() {
        if (!hasBody()) {
            throw new RuntimeException("Response body expected");
        }
        return this;
    }

    public boolean isOk() {
        return getStatus() == HttpStatus.SC_OK;
    }

    public <T> T getJson(Class<T> type) {
        assertBody();
        return JsonUtils.deserialize(body, type);