// Path: core/src/main/java/io/keen/client/java/exceptions/NoWriteKeyException.java
// public class NoWriteKeyException extends KeenException {
//     private static final long serialVersionUID = -8199471518510440670L;
// 
//     public NoWriteKeyException() {
//         super();
//     }
// 
//     public NoWriteKeyException(Throwable cause) {
//         super(cause);
//     }
// 
//     public NoWriteKeyException(String message) {
//         super(message);
//     }
// 
//     public NoWriteKeyException(String message, Throwable cause) {
//         super(message, cause);
//     }
// }
// 
// 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.SerializationFeature;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import io.keen.client.java.exceptions.KeenException;
import io.keen.client.java.exceptions.NoWriteKeyException;
import io.keen.client.java.exceptions.ServerException;
import io.keen.client.java.http.HttpHandler;
import io.keen.client.java.http.Request;
import io.keen.client.java.http.Response;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.endsWith;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
        GlobalPropertiesEvaluator evaluator = new GlobalPropertiesEvaluator() {
            @Override
            public Map<String, Object> getGlobalProperties(String eventCollection) {
                return new HashMap<String, Object>();
            }
        };
        runGlobalPropertiesEvaluatorTest(evaluator, 1);

        // an evaluator that returns a map w/ non-conflicting property names should be okay
        evaluator = new GlobalPropertiesEvaluator() {
            @Override
            public Map<String, Object> getGlobalProperties(String eventCollection) {
                Map<String, Object> globals = new HashMap<String, Object>();
                globals.put("default name", "default value");
                return globals;
            }
        };
        Map<String, Object> builtEvent = runGlobalPropertiesEvaluatorTest(evaluator, 2);
        assertEquals("default value", builtEvent.get("default name"));

        // an evaluator that returns a map w/ conflicting property name should not overwrite the property on the event
        evaluator = new GlobalPropertiesEvaluator() {
            @Override
            public Map<String, Object> getGlobalProperties(String eventCollection) {
                Map<String, Object> globals = new HashMap<String, Object>();
                globals.put("a", "c");
                return globals;
            }
        };
        builtEvent = runGlobalPropertiesEvaluatorTest(evaluator, 1);
// Path: core/src/main/java/io/keen/client/java/exceptions/NoWriteKeyException.java
// public class NoWriteKeyException extends KeenException {
//     private static final long serialVersionUID = -8199471518510440670L;
// 
//     public NoWriteKeyException() {
//         super();
//     }
// 
//     public NoWriteKeyException(Throwable cause) {
//         super(cause);
//     }
// 
//     public NoWriteKeyException(String message) {
//         super(message);
//     }
// 
//     public NoWriteKeyException(String message, Throwable cause) {
//         super(message, cause);
//     }
// }
// 
// 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: core/src/test/java/io/keen/client/java/KeenClientTest.java
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import io.keen.client.java.exceptions.KeenException;
import io.keen.client.java.exceptions.NoWriteKeyException;
import io.keen.client.java.exceptions.ServerException;
import io.keen.client.java.http.HttpHandler;
import io.keen.client.java.http.Request;
import io.keen.client.java.http.Response;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.endsWith;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

        GlobalPropertiesEvaluator evaluator = new GlobalPropertiesEvaluator() {
            @Override
            public Map<String, Object> getGlobalProperties(String eventCollection) {
                return new HashMap<String, Object>();
            }
        };
        runGlobalPropertiesEvaluatorTest(evaluator, 1);

        // an evaluator that returns a map w/ non-conflicting property names should be okay
        evaluator = new GlobalPropertiesEvaluator() {
            @Override
            public Map<String, Object> getGlobalProperties(String eventCollection) {
                Map<String, Object> globals = new HashMap<String, Object>();
                globals.put("default name", "default value");
                return globals;
            }
        };
        Map<String, Object> builtEvent = runGlobalPropertiesEvaluatorTest(evaluator, 2);
        assertEquals("default value", builtEvent.get("default name"));

        // an evaluator that returns a map w/ conflicting property name should not overwrite the property on the event
        evaluator = new GlobalPropertiesEvaluator() {
            @Override
            public Map<String, Object> getGlobalProperties(String eventCollection) {
                Map<String, Object> globals = new HashMap<String, Object>();
                globals.put("a", "c");
                return globals;
            }
        };
        builtEvent = runGlobalPropertiesEvaluatorTest(evaluator, 1);
        assertEquals("b", builtEvent.get("a"));