package com.uphold.uphold_android_sdk.test.unit.client;

import com.uphold.uphold_android_sdk.BuildConfig;
import com.uphold.uphold_android_sdk.client.UpholdClient;
import com.uphold.uphold_android_sdk.test.unit.util.MockSharedPreferencesContext;
import com.uphold.uphold_android_sdk.util.Header;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

import android.net.Uri;
import android.test.mock.MockContext;
import android.text.TextUtils;

import java.util.ArrayList;

/**
 * Unit tests to the class {@link Header}.
 */

@RunWith(PowerMockRunner.class)
@PrepareForTest({Uri.class, TextUtils.class})
public class UpholdClientTest {

    @Test
    public void beginAuthorizationShouldCallUriParse() throws Exception {
        UpholdClient.initialize(new MockSharedPreferencesContext());

        UpholdClient upholdClient = new UpholdClient();
        ArrayList<String> scopes = new ArrayList<String>() {{
            add("foo");
        }};

        PowerMockito.mockStatic(TextUtils.class);
        PowerMockito.when(TextUtils.join(" ", scopes)).thenReturn("foo");

        PowerMockito.mockStatic(Uri.class);
        upholdClient.beginAuthorization(new MockContext(), "foo", scopes, "bar");

        PowerMockito.verifyStatic();
        Uri.parse(String.format("%s/authorize/foo?scope=foo&state=bar", BuildConfig.AUTHORIZATION_SERVER_URL));
    }

}

@@ -50,16 +50,110 @@
 lient;%0A%0A
+import android.net.Uri;%0Aimport android.test.mock.MockContext;%0Aimport android.text.TextUtils;%0A%0A
 import c
@@ -194,16 +194,16 @@
 Config;%0A
-
 import c
@@ -384,16 +384,17 @@
 Header;%0A
+%0A
 import o
@@ -488,16 +488,83 @@
 ockito;%0A
+import org.powermock.core.classloader.annotations.PowerMockIgnore;%0A
 import o
@@ -679,102 +679,8 @@
 r;%0A%0A
-import android.net.Uri;%0Aimport android.test.mock.MockContext;%0Aimport android.text.TextUtils;%0A%0A
 impo
@@ -788,16 +788,16 @@
 .class)%0A
-
 @Prepare
@@ -834,16 +834,52 @@
 class%7D)%0A
+@PowerMockIgnore(%22javax.net.ssl.*%22)%0A
 public c

Update tests