package com.charlesmadere.hummingbird.models;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;

public class AuthInfo implements Parcelable {

    @SerializedName("password")
    private final String mPassword;

    @SerializedName("username")
    private final String mUsername;


    public AuthInfo(final String username, final String password) {
        mUsername = username;
        mPassword = password;
    }

    public String getPassword() {
        return mPassword;
    }

    public String getUsername() {
        return mUsername;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(final Parcel dest, final int flags) {
        dest.writeString(mPassword);
        dest.writeString(mUsername);
    }

    public static final Creator<AuthInfo> CREATOR = new Creator<AuthInfo>() {
        @Override
        public AuthInfo createFromParcel(final Parcel source) {
            final String password = source.readString();
            final String username = source.readString();
            return new AuthInfo(username, password);
        }

        @Override
        public AuthInfo[] newArray(final int size) {
            return new AuthInfo[size];
        }
    };

}

@@ -95,16 +95,47 @@
 celable;
+%0Aimport android.text.TextUtils;
 %0A%0Aimport
@@ -430,24 +430,292 @@
 password) %7B%0A
+        if (TextUtils.isEmpty(username)) %7B%0A            throw new IllegalArgumentException(%22username can't be null / empty%22);%0A        %7D else if (TextUtils.isEmpty(password)) %7B%0A            throw new IllegalArgumentException(%22password can't be null / empty%22);%0A        %7D%0A%0A
         mUse

throw exception if username / password is missing