Package org.springframework.social.dropbox.connect

Source Code of org.springframework.social.dropbox.connect.DropboxAdapterTest

package org.springframework.social.dropbox.connect;

import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.social.connect.UserProfile;
import org.springframework.social.dropbox.api.Dropbox;
import org.springframework.social.dropbox.api.DropboxUserProfile;

import java.math.BigInteger;

import static junit.framework.Assert.assertEquals;

/**
* @author Bryce Fischer
* @author Robert Drysdale
*/
public class DropboxAdapterTest {
    private DropboxAdapter adapter = new DropboxAdapter();
    private Dropbox dropboxApi = Mockito.mock(Dropbox.class);

    @Test
    public void fetchProfile() throws Exception {
        final String country = "USA";
        final String displayName = "DisplayName";
        final BigInteger uid = BigInteger.valueOf(1);
        final BigInteger sharedQuota = BigInteger.valueOf(123);
        final BigInteger quota = new BigInteger("62277025792");
        final BigInteger normalQuota = BigInteger.valueOf(323);
        String email = "emailaddress";
        String referralLink = "referralLink";

        Mockito.when(dropboxApi.getUserProfile())
                .thenReturn(new DropboxUserProfile(uid, displayName, email, country, referralLink, sharedQuota, quota, normalQuota));

        UserProfile profile = adapter.fetchUserProfile(dropboxApi);

        assertEquals(displayName, profile.getName());
    }
}
TOP

Related Classes of org.springframework.social.dropbox.connect.DropboxAdapterTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.