// Path: core/src/main/java/io/keen/client/java/http/Request.java
// public final class Request {
// 
//     ///// PROPERTIES /////
// 
//     public final URL url;
//     public final String method;
//     public final String authorization;
//     public final OutputSource body;
//     public final Proxy proxy;
//     public final int connectTimeout;
//     public final int readTimeout;
// 
//     ///// PUBLIC CONSTRUCTORS /////
// 
//     @Deprecated
//     public Request(URL url, String method, String authorization, OutputSource body) {
//         this(url, method, authorization, body, null, 30000, 30000);
//     }
// 
//     public Request(URL url, String method, String authorization, OutputSource body, Proxy proxy, int connectTimeout, int readTimeout) {
//         this.url = url;
//         this.method = method;
//         this.authorization = authorization;
//         this.body = body;
//         this.proxy = proxy;
//         this.connectTimeout = connectTimeout;
//         this.readTimeout = readTimeout;
//     }
// 
// }
// 
// Path: core/src/main/java/io/keen/client/java/http/Response.java
// public final class Response {
// 
//     ///// PROPERTIES /////
// 
//     public final int statusCode;
//     public final String body;
// 
//     ///// PUBLIC CONSTRUCTORS /////
// 
//     public Response(int statusCode, String body) {
//         this.statusCode = statusCode;
//         this.body = body;
//     }
// 
//     ///// PUBLIC METHODS /////
// 
//     public boolean isSuccess() {
//         return isSuccessCode(statusCode);
//     }
// 
//     ///// PRIVATE STATIC METHODS /////
// 
//     /**
//      * Checks whether an HTTP status code indicates success.
//      *
//      * @param statusCode The HTTP status code.
//      * @return {@code true} if the status code indicates success (2xx), otherwise {@code false}.
//      */
//     private static boolean isSuccessCode(int statusCode) {
//         return (statusCode / 100 == 2);
//     }
// 
// }


import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.keen.client.java.http.HttpHandler;
import io.keen.client.java.http.Request;
import io.keen.client.java.http.Response;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.MockitoAnnotations;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
        KeenLogging.disableLogging();
        TEST_PROJECT = null;
    }

    @Before
    public void setup() throws IOException {
        MockitoAnnotations.initMocks(this);

        // Set up a mock HTTP handler.
        mockHttpHandler = mock(HttpHandler.class);
        setMockResponse(500, "Unexpected HTTP request");

        // build the client
        queryClient = new KeenQueryClient.Builder(TEST_PROJECT)
                .withJsonHandler(new TestJsonHandler())
                .withHttpHandler(mockHttpHandler)
                .build();
    }

    @After
    public void cleanUp() {
        queryClient = null;
        numExecuteCalls = 0;
    }

    @Captor
    private ArgumentCaptor<Request> requestArgumentCaptor;
    private int numExecuteCalls = 0;

    void setMockResponse(int statusCode, String body) throws IOException {
// Path: core/src/main/java/io/keen/client/java/http/Request.java
// public final class Request {
// 
//     ///// PROPERTIES /////
// 
//     public final URL url;
//     public final String method;
//     public final String authorization;
//     public final OutputSource body;
//     public final Proxy proxy;
//     public final int connectTimeout;
//     public final int readTimeout;
// 
//     ///// PUBLIC CONSTRUCTORS /////
// 
//     @Deprecated
//     public Request(URL url, String method, String authorization, OutputSource body) {
//         this(url, method, authorization, body, null, 30000, 30000);
//     }
// 
//     public Request(URL url, String method, String authorization, OutputSource body, Proxy proxy, int connectTimeout, int readTimeout) {
//         this.url = url;
//         this.method = method;
//         this.authorization = authorization;
//         this.body = body;
//         this.proxy = proxy;
//         this.connectTimeout = connectTimeout;
//         this.readTimeout = readTimeout;
//     }
// 
// }
// 
// Path: core/src/main/java/io/keen/client/java/http/Response.java
// public final class Response {
// 
//     ///// PROPERTIES /////
// 
//     public final int statusCode;
//     public final String body;
// 
//     ///// PUBLIC CONSTRUCTORS /////
// 
//     public Response(int statusCode, String body) {
//         this.statusCode = statusCode;
//         this.body = body;
//     }
// 
//     ///// PUBLIC METHODS /////
// 
//     public boolean isSuccess() {
//         return isSuccessCode(statusCode);
//     }
// 
//     ///// PRIVATE STATIC METHODS /////
// 
//     /**
//      * Checks whether an HTTP status code indicates success.
//      *
//      * @param statusCode The HTTP status code.
//      * @return {@code true} if the status code indicates success (2xx), otherwise {@code false}.
//      */
//     private static boolean isSuccessCode(int statusCode) {
//         return (statusCode / 100 == 2);
//     }
// 
// }


// Path: query/src/test/java/io/keen/client/java/KeenQueryTestBase.java
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.keen.client.java.http.HttpHandler;
import io.keen.client.java.http.Request;
import io.keen.client.java.http.Response;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.MockitoAnnotations;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

        KeenLogging.disableLogging();
        TEST_PROJECT = null;
    }

    @Before
    public void setup() throws IOException {
        MockitoAnnotations.initMocks(this);

        // Set up a mock HTTP handler.
        mockHttpHandler = mock(HttpHandler.class);
        setMockResponse(500, "Unexpected HTTP request");

        // build the client
        queryClient = new KeenQueryClient.Builder(TEST_PROJECT)
                .withJsonHandler(new TestJsonHandler())
                .withHttpHandler(mockHttpHandler)
                .build();
    }

    @After
    public void cleanUp() {
        queryClient = null;
        numExecuteCalls = 0;
    }

    @Captor
    private ArgumentCaptor<Request> requestArgumentCaptor;
    private int numExecuteCalls = 0;

    void setMockResponse(int statusCode, String body) throws IOException {
        Response response = new Response(statusCode, body);