// Path: core/src/main/java/io/keen/client/java/KeenConstants.java
// public final class KeenConstants {
//     private KeenConstants() {}
// 
//     static final String SERVER_ADDRESS = "https://api.keen.io";
//     static final String API_VERSION = "3.0";
// 
//     // Keen API constants
// 
//     static final int MAX_EVENT_DEPTH = 1000;
//     static final int DEFAULT_MAX_ATTEMPTS = 3;
//     static final String NAME_PARAM = "name";
//     static final String SUCCESS_PARAM = "success";
//     static final String ERROR_PARAM = "error";
//     static final String DESCRIPTION_PARAM = "description";
//     static final String INVALID_COLLECTION_NAME_ERROR = "InvalidCollectionNameError";
//     static final String INVALID_PROPERTY_NAME_ERROR = "InvalidPropertyNameError";
//     static final String INVALID_PROPERTY_VALUE_ERROR = "InvalidPropertyValueError";
// 
//     // Exported constants
// 
//     public static final String KEEN_FAKE_JSON_ROOT = "io.keen.client.java.__fake_root";
// }


import org.hamcrest.Matchers;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONTokener;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.keen.client.java.KeenConstants;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

        // This string doesn't matter, but it's what we mimic with the mocks.
        String mapResponse = "{\"result\": \"dummyResult\"}";
        StringReader reader = new StringReader(mapResponse);
        Map<String, Object> map = handler.readJson(reader);
        assertNotNull(map);
        assertEquals(1, map.size());
        assertTrue(map.containsKey("result"));
        assertEquals("dummyResult", map.get("result"));
    }

    @Test
    public void readSimpleList() throws Exception {
        JSONArray mockJsonArray = mock(JSONArray.class);
        when(mockJsonArray.length()).thenReturn(1);
        when(mockJsonArray.get(0)).thenReturn("dummyResult");

        JSONTokener mockJsonTokener = mock(JSONTokener.class);
        when(mockJsonTokener.nextValue()).thenReturn(mockJsonArray);
        when(mockJsonObjectManager.newTokener(anyString())).thenReturn(mockJsonTokener);

        // This string doesn't matter, but it's what we mimic with the mocks.
        String listResponse = "[\"dummyResult\"]";
        StringReader reader = new StringReader(listResponse);
        Map<String, Object> map = handler.readJson(reader);
        assertNotNull(map);
        assertEquals(1, map.size());

        // Validate that the raw JSON Array was wrapped in the fake root object. This behavior
        // should change as soon as we can release a major version update to not do this dance.
// Path: core/src/main/java/io/keen/client/java/KeenConstants.java
// public final class KeenConstants {
//     private KeenConstants() {}
// 
//     static final String SERVER_ADDRESS = "https://api.keen.io";
//     static final String API_VERSION = "3.0";
// 
//     // Keen API constants
// 
//     static final int MAX_EVENT_DEPTH = 1000;
//     static final int DEFAULT_MAX_ATTEMPTS = 3;
//     static final String NAME_PARAM = "name";
//     static final String SUCCESS_PARAM = "success";
//     static final String ERROR_PARAM = "error";
//     static final String DESCRIPTION_PARAM = "description";
//     static final String INVALID_COLLECTION_NAME_ERROR = "InvalidCollectionNameError";
//     static final String INVALID_PROPERTY_NAME_ERROR = "InvalidPropertyNameError";
//     static final String INVALID_PROPERTY_VALUE_ERROR = "InvalidPropertyValueError";
// 
//     // Exported constants
// 
//     public static final String KEEN_FAKE_JSON_ROOT = "io.keen.client.java.__fake_root";
// }


// Path: android/src/test/java/io/keen/client/android/AndroidJsonHandlerTest.java
import org.hamcrest.Matchers;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONTokener;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.keen.client.java.KeenConstants;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;


        // This string doesn't matter, but it's what we mimic with the mocks.
        String mapResponse = "{\"result\": \"dummyResult\"}";
        StringReader reader = new StringReader(mapResponse);
        Map<String, Object> map = handler.readJson(reader);
        assertNotNull(map);
        assertEquals(1, map.size());
        assertTrue(map.containsKey("result"));
        assertEquals("dummyResult", map.get("result"));
    }

    @Test
    public void readSimpleList() throws Exception {
        JSONArray mockJsonArray = mock(JSONArray.class);
        when(mockJsonArray.length()).thenReturn(1);
        when(mockJsonArray.get(0)).thenReturn("dummyResult");

        JSONTokener mockJsonTokener = mock(JSONTokener.class);
        when(mockJsonTokener.nextValue()).thenReturn(mockJsonArray);
        when(mockJsonObjectManager.newTokener(anyString())).thenReturn(mockJsonTokener);

        // This string doesn't matter, but it's what we mimic with the mocks.
        String listResponse = "[\"dummyResult\"]";
        StringReader reader = new StringReader(listResponse);
        Map<String, Object> map = handler.readJson(reader);
        assertNotNull(map);
        assertEquals(1, map.size());

        // Validate that the raw JSON Array was wrapped in the fake root object. This behavior
        // should change as soon as we can release a major version update to not do this dance.
        assertTrue(map.containsKey(KeenConstants.KEEN_FAKE_JSON_ROOT));