/*
 * Copyright (C) 2013 Clarion Media, LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.clarionmedia.jockey.authentication.impl;

import com.xtremelabs.robolectric.RobolectricTestRunner;
import org.junit.runner.RunWith;

@RunWith(RobolectricTestRunner.class)
public class AppEngineAuthenticatorTest {



}

@@ -665,173 +665,2433 @@
 ort 
-com.xtremelabs.robolectric.RobolectricTestRunner;%0Aimport org.junit.runner.RunWith;%0A%0A@RunWith(RobolectricTestRunner.class)%0Apublic class AppEngineAuthenticatorTest %7B%0A%0A
+android.accounts.Account;%0Aimport android.accounts.AccountManager;%0Aimport android.app.Activity;%0Aimport android.content.Context;%0Aimport com.xtremelabs.robolectric.RobolectricTestRunner;%0Aimport org.apache.http.client.HttpClient;%0Aimport org.apache.http.params.HttpParams;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Mock;%0Aimport org.mockito.MockitoAnnotations;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.when;%0A%0A@RunWith(RobolectricTestRunner.class)%0Apublic class AppEngineAuthenticatorTest %7B%0A%0A    @Mock%0A    private Context mMockContext;%0A%0A    @Mock%0A    private AccountManager mMockAccountManager;%0A%0A    @Mock%0A    private Account mMockAccount;%0A%0A    @Mock%0A    private HttpClient mMockHttpClient;%0A%0A    @Mock%0A    private Activity mMockActivity;%0A%0A    @Mock%0A    private AppEngineAuthTokenCallback mMockAuthTokenCallback;%0A%0A    @Mock%0A    private HttpParams mMockHttpParams;%0A%0A    private String mUrl = %22foo%22;%0A%0A    private AppEngineAuthenticator mAppEngineAuthenticator;%0A%0A    @Before%0A    public void setup() %7B%0A        MockitoAnnotations.initMocks(this);%0A        when(mMockContext.getApplicationContext()).thenReturn(mMockContext);%0A        when(mMockHttpClient.getParams()).thenReturn(mMockHttpParams);%0A        mAppEngineAuthenticator = new AppEngineAuthenticator(mMockContext, mMockAccountManager, mMockAccount,%0A                mMockHttpClient, mUrl, mMockActivity);%0A        mAppEngineAuthenticator.setAuthCallback(mMockAuthTokenCallback);%0A    %7D%0A%0A    @Test%0A    public void testAuthenticateWithPromptActivity() %7B%0A        mAppEngineAuthenticator.authenticate();%0A%0A        verify(mMockAccountManager)%0A                .getAuthToken(mMockAccount, %22ah%22, null, mMockActivity, mMockAuthTokenCallback, null);%0A    %7D%0A%0A    @Test%0A    public void testAuthenticateNoPromptActivity() %7B%0A        mAppEngineAuthenticator.setPromptActivity(null);%0A%0A        mAppEngineAuthenticator.authenticate();%0A%0A        verify(mMockAccountManager).getAuthToken(mMockAccount, %22ah%22, false, mMockAuthTokenCallback, null);%0A    %7D%0A%0A    @Test%0A    public void testGetAuthUrl() %7B%0A        String token = %22bar%22;%0A        String expected = mUrl + %22/_ah/login?continue=http://localhost/&auth=%22 + token;%0A%0A        String actual = mAppEngineAuthenticator.getAuthUrl(token);%0A%0A        assertEquals(%22Auth URL should equal expected value%22, expected, actual);%0A    %7D
 %0A%0A%7D%0A

Add unit tests for AppEngineAuthenticator