// 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;
        assertThat(callback.account.getEmail()).isEqualTo("john.deere@example.com");
        assertThat(callback.account.getUsername()).isEqualTo("john.deere@example.com");
        assertThat(callback.account.getGivenName()).isEqualTo("John");
        assertThat(callback.account.getMiddleName()).isNull();
        assertThat(callback.account.getSurname()).isEqualTo("Deere");
        assertThat(callback.account.getFullName()).isEqualTo("John Deere");
        assertThat(callback.account.getStatus()).isEqualTo("ENABLED");
    }

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

        enqueueEmptyResponse(HttpURLConnection.HTTP_BAD_REQUEST);
        StormpathCallback<Account> callback = mock(StormpathCallback.class);
        Stormpath.getAccount(callback);

        verify(callback).onFailure(any(StormpathError.class));
    }

    @Test
    public void failedDeserializationCallsFailure() throws Exception {
        enqueueEmptyResponse(HttpURLConnection.HTTP_OK);
        StormpathCallback<Account> callback = mock(StormpathCallback.class);
        Stormpath.getAccount(callback);

        verify(callback).onFailure(any(StormpathError.class));
    }

    @Test
// 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;

        assertThat(callback.account.getEmail()).isEqualTo("john.deere@example.com");
        assertThat(callback.account.getUsername()).isEqualTo("john.deere@example.com");
        assertThat(callback.account.getGivenName()).isEqualTo("John");
        assertThat(callback.account.getMiddleName()).isNull();
        assertThat(callback.account.getSurname()).isEqualTo("Deere");
        assertThat(callback.account.getFullName()).isEqualTo("John Deere");
        assertThat(callback.account.getStatus()).isEqualTo("ENABLED");
    }

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

        enqueueEmptyResponse(HttpURLConnection.HTTP_BAD_REQUEST);
        StormpathCallback<Account> callback = mock(StormpathCallback.class);
        Stormpath.getAccount(callback);

        verify(callback).onFailure(any(StormpathError.class));
    }

    @Test
    public void failedDeserializationCallsFailure() throws Exception {
        enqueueEmptyResponse(HttpURLConnection.HTTP_OK);
        StormpathCallback<Account> callback = mock(StormpathCallback.class);
        Stormpath.getAccount(callback);

        verify(callback).onFailure(any(StormpathError.class));
    }

    @Test
    public void missingAccessTokenCallsFailureWithoutCallingApi() throws Exception {