// Path: sdk/src/main/java/com/stormpath/sdk/models/Account.java
// public class Account implements Serializable {
// 
//     @Json(name = "href")
//     private String href;
// 
//     @Json(name = "email")
//     private String email;
// 
//     @Json(name = "givenName")
//     private String givenName;
// 
//     @Json(name = "middleName")
//     private String middleName;
// 
//     @Json(name = "surname")
//     private String surname;
// 
//     @Json(name = "fullName")
//     private String fullName;
// 
//     @Json(name = "status")
//     private String status;
// 
//     @Json(name = "username")
//     private String username;
// 
//     @Json(name = "customData")
//     private Object customData;
// 
//     public String getHref() {
//         return href;
//     }
// 
//     public String getEmail() {
//         return email;
//     }
// 
//     public String getGivenName() {
//         return givenName;
//     }
// 
//     public String getMiddleName() {
//         return middleName;
//     }
// 
//     public String getSurname() {
//         return surname;
//     }
// 
//     public String getFullName() {
//         return fullName;
//     }
// 
//     public String getStatus() {
//         return status;
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public Object getCustomData() {
//         return customData;
//     }
// }
// 
// Path: sdk/src/main/java/com/stormpath/sdk/models/StormpathError.java
// public class StormpathError implements Serializable {
// 
//     @Json(name = "status")
//     private int status;
// 
//     @Json(name = "message")
//     private String message;
// 
//     @Json(name = "code")
//     private int code;
// 
//     @Json(name = "developerMessage")
//     private String developerMessage;
// 
//     @Json(name = "moreInfo")
//     private String moreInfo;
// 
//     @Nullable
//     private transient Throwable throwable;
// 
//     /**
//      * Constructor for manually building an error when a local exception happens.
//      *
//      * @param message   a user-friendly message
//      * @param throwable the exception we caught
//      */
//     public StormpathError(String message, @NonNull Throwable throwable) {
//         this.throwable = throwable;
//         this.message = message;
//         this.developerMessage = throwable.getMessage();
//         this.status = -1;
//         this.code = -1;
//     }
// 
//     public int status() {
//         return status;
//     }
// 
//     /**
//      * @return an end-user error message
//      */
//     public String message() {
//         return message;
//     }
// 
//     public int code() {
//         return code;
//     }
// 
//     public String developerMessage() {
//         return developerMessage;
//     }
// 
//     public String moreInfo() {
//         return moreInfo;
//     }
// 
//     /**
//      * @return the throwable which caused the error, or null if the error was returned by the API
//      */
//     @Nullable
//     public Throwable throwable() {
//         return throwable;
//     }
// }


import com.stormpath.sdk.models.Account;
import com.stormpath.sdk.models.StormpathError;
import org.junit.Test;
import java.net.HttpURLConnection;
import okhttp3.mockwebserver.RecordedRequest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.stub;
import static org.mockito.Mockito.verify;
package com.stormpath.sdk;






public class UserProfileTest extends BaseTest {

    @Override
    public void setUp() throws Exception {
        super.setUp();
        initWithDefaults();
    }

    @Test
    public void correctRequest() throws Exception {
        String accessToken = "eyJraWQiOiI2WjA3NEJBQzhTM0tGWE5KOVhFTldEVUhGIiwiYWxnIjoiSFMyNTYifQ.eyJqdGkiOiIzQjlEclh4NG9RdFR6VWU0dFhCR0d5I"
                + "iwiaWF0IjoxNDU1MjE4Mzg0LCJpc3MiOiJodHRwczovL2FwaS5zdG9ybXBhdGguY29tL3YxL2FwcGxpY2F0aW9ucy8yUnJxS25UaW91M1F3Tm50RTN0Y0VHI"
                + "iwic3ViIjoiaHR0cHM6Ly9hcGkuc3Rvcm1wYXRoLmNvbS92MS9hY2NvdW50cy81TXNRVEE0UVI5c0hZNnlRQlFFSXlLIiwiZXhwIjoxNDYwNDAyMzg0fQ.lt"
                + "Fz1735IRnD0vIgdeKC4oInxe8K0KzhDJ95RgRuqmA";
        stub(mockPlatform().preferenceStore().getAccessToken()).toReturn(accessToken);

        enqueueResponse("stormpath-user-profile-response.json");
        Stormpath.getAccount(mock(StormpathCallback.class));

        RecordedRequest request = takeLastRequest();

        assertThat(request.getMethod()).isEqualTo("GET");
        assertThat(request.getPath()).isEqualTo("/me");
        assertThat(request.getHeader("Authorization")).isEqualTo("Bearer " + accessToken);
        assertThat(request.getHeader("Accept")).isEqualTo("application/json");
    }

    @Test
    public void successfulFetchCallsSuccess() throws Exception {
        stub(mockPlatform().preferenceStore().getAccessToken()).toReturn("abcdefghijklmnopqrstuvwyxz0123456789");

        enqueueResponse("stormpath-user-profile-response.json");
// Path: sdk/src/main/java/com/stormpath/sdk/models/Account.java
// public class Account implements Serializable {
// 
//     @Json(name = "href")
//     private String href;
// 
//     @Json(name = "email")
//     private String email;
// 
//     @Json(name = "givenName")
//     private String givenName;
// 
//     @Json(name = "middleName")
//     private String middleName;
// 
//     @Json(name = "surname")
//     private String surname;
// 
//     @Json(name = "fullName")
//     private String fullName;
// 
//     @Json(name = "status")
//     private String status;
// 
//     @Json(name = "username")
//     private String username;
// 
//     @Json(name = "customData")
//     private Object customData;
// 
//     public String getHref() {
//         return href;
//     }
// 
//     public String getEmail() {
//         return email;
//     }
// 
//     public String getGivenName() {
//         return givenName;
//     }
// 
//     public String getMiddleName() {
//         return middleName;
//     }
// 
//     public String getSurname() {
//         return surname;
//     }
// 
//     public String getFullName() {
//         return fullName;
//     }
// 
//     public String getStatus() {
//         return status;
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public Object getCustomData() {
//         return customData;
//     }
// }
// 
// Path: sdk/src/main/java/com/stormpath/sdk/models/StormpathError.java
// public class StormpathError implements Serializable {
// 
//     @Json(name = "status")
//     private int status;
// 
//     @Json(name = "message")
//     private String message;
// 
//     @Json(name = "code")
//     private int code;
// 
//     @Json(name = "developerMessage")
//     private String developerMessage;
// 
//     @Json(name = "moreInfo")
//     private String moreInfo;
// 
//     @Nullable
//     private transient Throwable throwable;
// 
//     /**
//      * Constructor for manually building an error when a local exception happens.
//      *
//      * @param message   a user-friendly message
//      * @param throwable the exception we caught
//      */
//     public StormpathError(String message, @NonNull Throwable throwable) {
//         this.throwable = throwable;
//         this.message = message;
//         this.developerMessage = throwable.getMessage();
//         this.status = -1;
//         this.code = -1;
//     }
// 
//     public int status() {
//         return status;
//     }
// 
//     /**
//      * @return an end-user error message
//      */
//     public String message() {
//         return message;
//     }
// 
//     public int code() {
//         return code;
//     }
// 
//     public String developerMessage() {
//         return developerMessage;
//     }
// 
//     public String moreInfo() {
//         return moreInfo;
//     }
// 
//     /**
//      * @return the throwable which caused the error, or null if the error was returned by the API
//      */
//     @Nullable
//     public Throwable throwable() {
//         return throwable;
//     }
// }


// Path: sdk/src/test/java/com/stormpath/sdk/UserProfileTest.java
import com.stormpath.sdk.models.Account;
import com.stormpath.sdk.models.StormpathError;
import org.junit.Test;
import java.net.HttpURLConnection;
import okhttp3.mockwebserver.RecordedRequest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.stub;
import static org.mockito.Mockito.verify;

package com.stormpath.sdk;






public class UserProfileTest extends BaseTest {

    @Override
    public void setUp() throws Exception {
        super.setUp();
        initWithDefaults();
    }

    @Test
    public void correctRequest() throws Exception {
        String accessToken = "eyJraWQiOiI2WjA3NEJBQzhTM0tGWE5KOVhFTldEVUhGIiwiYWxnIjoiSFMyNTYifQ.eyJqdGkiOiIzQjlEclh4NG9RdFR6VWU0dFhCR0d5I"
                + "iwiaWF0IjoxNDU1MjE4Mzg0LCJpc3MiOiJodHRwczovL2FwaS5zdG9ybXBhdGguY29tL3YxL2FwcGxpY2F0aW9ucy8yUnJxS25UaW91M1F3Tm50RTN0Y0VHI"
                + "iwic3ViIjoiaHR0cHM6Ly9hcGkuc3Rvcm1wYXRoLmNvbS92MS9hY2NvdW50cy81TXNRVEE0UVI5c0hZNnlRQlFFSXlLIiwiZXhwIjoxNDYwNDAyMzg0fQ.lt"
                + "Fz1735IRnD0vIgdeKC4oInxe8K0KzhDJ95RgRuqmA";
        stub(mockPlatform().preferenceStore().getAccessToken()).toReturn(accessToken);

        enqueueResponse("stormpath-user-profile-response.json");
        Stormpath.getAccount(mock(StormpathCallback.class));

        RecordedRequest request = takeLastRequest();

        assertThat(request.getMethod()).isEqualTo("GET");
        assertThat(request.getPath()).isEqualTo("/me");
        assertThat(request.getHeader("Authorization")).isEqualTo("Bearer " + accessToken);
        assertThat(request.getHeader("Accept")).isEqualTo("application/json");
    }

    @Test
    public void successfulFetchCallsSuccess() throws Exception {
        stub(mockPlatform().preferenceStore().getAccessToken()).toReturn("abcdefghijklmnopqrstuvwyxz0123456789");

        enqueueResponse("stormpath-user-profile-response.json");
        StormpathCallback<Account> callback = mock(StormpathCallback.class);