// Path: sdk/src/test/java/com/stormpath/sdk/utils/MockAndroidPlatform.java
// public class MockAndroidPlatform extends AndroidPlatform {
// 
//     PreferenceStore preferenceStore = mock(PreferenceStore.class);
// 
//     ExecutorService synchronousExecutorService = new SynchronousExecutorService();
// 
//     StormpathLogger logger = mock(StormpathLogger.class);
// 
//     public MockAndroidPlatform() {
//         super(Mocks.appContext());
//     }
// 
//     @Override
//     public PreferenceStore preferenceStore() {
//         return preferenceStore;
//     }
// 
//     @Override
//     public ExecutorService httpExecutorService() {
//         return synchronousExecutorService;
//     }
// 
//     @Override
//     public Executor callbackExecutor() {
//         return synchronousExecutorService;
//     }
// 
//     @Override
//     public StormpathLogger logger() {
//         return logger;
//     }
// 
//     @Override
//     public String unknownErrorMessage() {
//         return "There was an unexpected error, please try again later.";
//     }
// 
//     @Override
//     public String networkErrorMessage() {
//         return "There was a problem with the network connection, please check your settings.";
//     }
// }
// 
// Path: sdk/src/test/java/com/stormpath/sdk/utils/ResourceUtils.java
// public class ResourceUtils {
// 
//     private static final String MOCK_DATA_DIRECTORY = "mockdata/%s";
// 
//     private ResourceUtils() {
//     }
// 
//     /**
//      * Converts InputStream to String.
//      */
//     public static String convertStreamToString(InputStream is) {
//         Scanner s = new Scanner(is, "UTF-8").useDelimiter("\\A");
//         return s.hasNext() ? s.next() : "";
//     }
// 
//     /**
//      * Reads a resource file to <code>String</code>.
//      */
//     public static String readFromFile(String filename) {
//         InputStream is = ResourceUtils.class.getClassLoader().getResourceAsStream(String.format(MOCK_DATA_DIRECTORY, filename));
//         return convertStreamToString(is);
//     }
// }


import com.stormpath.sdk.utils.MockAndroidPlatform;
import com.stormpath.sdk.utils.ResourceUtils;
import org.junit.After;
import org.junit.Before;
import java.net.HttpURLConnection;
import java.util.concurrent.TimeUnit;
import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import okhttp3.mockwebserver.RecordedRequest;
            mockWebServer.shutdown();
        } catch (Throwable t) {
            // Frankly, my dear, I don't give a damn
        }
    }

    protected String mockServerUrl() {
        return mockWebServer.url("/").toString();
    }

    protected Platform mockPlatform() {
        return mockPlatform;
    }

    protected void initWithDefaults() {
        StormpathConfiguration config = new StormpathConfiguration.Builder().baseUrl(mockServerUrl()).build();
        Stormpath.init(mockPlatform, config);
        Stormpath.setLogLevel(StormpathLogger.VERBOSE);
    }

    protected void enqueueResponse(MockResponse mockResponse) {
        mockWebServer.enqueue(mockResponse);
    }

    protected void enqueueStringResponse(String body) {
        MockResponse mockResponse = new MockResponse().setBody(body).setResponseCode(HttpURLConnection.HTTP_OK);
        mockWebServer.enqueue(mockResponse);
    }

    protected void enqueueResponse(String filename) {
// Path: sdk/src/test/java/com/stormpath/sdk/utils/MockAndroidPlatform.java
// public class MockAndroidPlatform extends AndroidPlatform {
// 
//     PreferenceStore preferenceStore = mock(PreferenceStore.class);
// 
//     ExecutorService synchronousExecutorService = new SynchronousExecutorService();
// 
//     StormpathLogger logger = mock(StormpathLogger.class);
// 
//     public MockAndroidPlatform() {
//         super(Mocks.appContext());
//     }
// 
//     @Override
//     public PreferenceStore preferenceStore() {
//         return preferenceStore;
//     }
// 
//     @Override
//     public ExecutorService httpExecutorService() {
//         return synchronousExecutorService;
//     }
// 
//     @Override
//     public Executor callbackExecutor() {
//         return synchronousExecutorService;
//     }
// 
//     @Override
//     public StormpathLogger logger() {
//         return logger;
//     }
// 
//     @Override
//     public String unknownErrorMessage() {
//         return "There was an unexpected error, please try again later.";
//     }
// 
//     @Override
//     public String networkErrorMessage() {
//         return "There was a problem with the network connection, please check your settings.";
//     }
// }
// 
// Path: sdk/src/test/java/com/stormpath/sdk/utils/ResourceUtils.java
// public class ResourceUtils {
// 
//     private static final String MOCK_DATA_DIRECTORY = "mockdata/%s";
// 
//     private ResourceUtils() {
//     }
// 
//     /**
//      * Converts InputStream to String.
//      */
//     public static String convertStreamToString(InputStream is) {
//         Scanner s = new Scanner(is, "UTF-8").useDelimiter("\\A");
//         return s.hasNext() ? s.next() : "";
//     }
// 
//     /**
//      * Reads a resource file to <code>String</code>.
//      */
//     public static String readFromFile(String filename) {
//         InputStream is = ResourceUtils.class.getClassLoader().getResourceAsStream(String.format(MOCK_DATA_DIRECTORY, filename));
//         return convertStreamToString(is);
//     }
// }


// Path: sdk/src/test/java/com/stormpath/sdk/BaseTest.java
import com.stormpath.sdk.utils.MockAndroidPlatform;
import com.stormpath.sdk.utils.ResourceUtils;
import org.junit.After;
import org.junit.Before;
import java.net.HttpURLConnection;
import java.util.concurrent.TimeUnit;
import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import okhttp3.mockwebserver.RecordedRequest;

            mockWebServer.shutdown();
        } catch (Throwable t) {
            // Frankly, my dear, I don't give a damn
        }
    }

    protected String mockServerUrl() {
        return mockWebServer.url("/").toString();
    }

    protected Platform mockPlatform() {
        return mockPlatform;
    }

    protected void initWithDefaults() {
        StormpathConfiguration config = new StormpathConfiguration.Builder().baseUrl(mockServerUrl()).build();
        Stormpath.init(mockPlatform, config);
        Stormpath.setLogLevel(StormpathLogger.VERBOSE);
    }

    protected void enqueueResponse(MockResponse mockResponse) {
        mockWebServer.enqueue(mockResponse);
    }

    protected void enqueueStringResponse(String body) {
        MockResponse mockResponse = new MockResponse().setBody(body).setResponseCode(HttpURLConnection.HTTP_OK);
        mockWebServer.enqueue(mockResponse);
    }

    protected void enqueueResponse(String filename) {
        String body = ResourceUtils.readFromFile(filename);