Package com.google.code.facebookapi

Source Code of com.google.code.facebookapi.Issue99FriendsGetCachedPOJOTest

package com.google.code.facebookapi;

import static org.junit.Assert.assertNotNull;

import java.util.EnumSet;
import java.util.List;

import org.junit.Test;

import com.google.code.facebookapi.schema.FriendsGetResponse;
import com.google.code.facebookapi.schema.User;
import com.google.code.facebookapi.schema.UsersGetInfoResponse;

public class Issue99FriendsGetCachedPOJOTest {

  @Test
  public void testFriendsGetCachedReturnsPOJO() throws Exception {
    FacebookJaxbRestClient client = FacebookSessionTestUtils.getValidClient( FacebookJaxbRestClient.class );

    // keep track of the logged in user id
    Long userId = client.users_getLoggedInUser();
    assertNotNull( userId );

    // Get friends list
    client.friends_get();
    FriendsGetResponse response = (FriendsGetResponse) client.getResponsePOJO();
    List<Long> friends = response.getUid();

    // Go fetch the information for the user list of user ids
    client.users_getInfo( friends, EnumSet.of( ProfileField.NAME ) );

    UsersGetInfoResponse userResponse = (UsersGetInfoResponse) client.getResponsePOJO();

    // Print out the user information
    List<User> users = userResponse.getUser();
    for ( User user : users ) {
      assertNotNull( user.getName() );
    }
  }

}
TOP

Related Classes of com.google.code.facebookapi.Issue99FriendsGetCachedPOJOTest

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.