Package com.restfb.types

Examples of com.restfb.types.Post$Privacy


public class PostWithTotalCountITCase extends RestFbIntegrationTestBase {

  @Test
  public void checkPostWithCommentsAndLikes() {
    DefaultFacebookClient client = new DefaultFacebookClient(getAccessToken(), Version.VERSION_2_1);
    Post gotPost =
        client.fetchObject("74133697733_10152424266332734", Post.class,
          Parameter.with("fields", "from,to,likes.summary(true),comments.summary(true)"));
    assertNotNull(gotPost);
    assertTrue(gotPost.getLikesCount() > 0);
    assertTrue(gotPost.getLikes().getCount() > 0);
    assertEquals(gotPost.getLikesCount(), gotPost.getLikes().getCount());
    assertTrue(gotPost.getComments().getTotalCount() > 0);
  }
View Full Code Here


    User user2 = jsonMapper.toJavaObject(jsonFromClasspath("user-with-hometown-v2"), User.class);
    assertTrue("Belgrade, Serbia".equals(user2.getHometown().getName()));
    assertTrue("Belgrade, Serbia".equals(user2.getHometownName()));

    Post post1 = jsonMapper.toJavaObject(jsonFromClasspath("post-with-likes-v1"), Post.class);
    assertTrue(post1.getLikesCount() == 4);
    assertTrue(post1.getLikes() == null);

    Post post2 = jsonMapper.toJavaObject(jsonFromClasspath("post-with-likes-v2"), Post.class);
    assertTrue(post2.getLikes().getCount() == 49);
    assertTrue(post2.getLikesCount() == 49);
  }
View Full Code Here

  /**
   * Can we handle comments that are empty arrays?
   */
  @Test
  public void emptyArrayTest() {
    Post post = createJsonMapper().toJavaObject(jsonFromClasspath("post-with-empty-comments"), Post.class);
    assertTrue(post.getComments().getTotalCount() == 0);
    assertTrue(post.getComments().getData().size() == 0);
  }
View Full Code Here

  /**
   * Can we handle comments that are objects with only a count and no data?
   */
  @Test
  public void onlyCountTest() {
    Post post = createJsonMapper().toJavaObject(jsonFromClasspath("post-with-comment-count-only"), Post.class);
    assertTrue(post.getComments().getTotalCount() == 3);
  }
View Full Code Here

  /**
   * Can we handle comments that are objects with only a count and no data?
   */
  @Test
  public void normalTest() {
    Post post = createJsonMapper().toJavaObject(jsonFromClasspath("post-with-normal-comments"), Post.class);
    assertTrue(post.getComments().getData().size() == 1);
  }
View Full Code Here

  }

  public void testGetContentString() throws IOException {
    String contentUrl = "facebook/accessTokenKey/fbid/post";   
   
    Post expectedPost = loadObjectFromJSON("/examples/post.json",Post.class);
   
    //expected behavior 
    expect(mockFactory.createFacebookAPIClient(EasyMock.anyObject(String.class))).andReturn(mockFbClient);
    expect(mockFbClient.getFacebookObjectByID("fbid", Post.class)).andReturn(expectedPost);
       
View Full Code Here

   *     the content url
   * @return a {#link=Content} object
   */
  public Content getContent(String contentURL) {
    String fbid = URLUtils.getFbId(contentURL);
    Post post = getFbClient().getFacebookObjectByID(fbid, Post.class);

    Content content = post2Content(post);
    content.setContentUrl(contentURL);

    return content;
View Full Code Here

  }
 
  public void testGetContentString() throws IOException {
    String contentUrl = "facebook/accessTokenKey/fbid/post";   
   
    Post expectedPost = loadObjectFromJSON("/examples/post.json",Post.class);
   
    //expected behavior 
    expect(mockFactory.createFacebookAPIClient(EasyMock.anyObject(String.class))).andReturn(mockFbClient);
    expect(mockFbClient.getFacebookObjectByID("fbid", Post.class)).andReturn(expectedPost);
       
View Full Code Here

  public void testGetFacebookConnectionByID() {

    // declare behavior
    List<Post> posts = new ArrayList<Post>();
    posts.add(new Post());

    Connection<Post> mockDataList = EasyMock.createMock(Connection.class);
    expect(
        mockFb.fetchConnection("profileId/feeds", Post.class)).andReturn(mockDataList);
    expect(mockDataList.getData()).andReturn(posts);
View Full Code Here

  }

  public void testPublishObject() {

    // declare behavior
    Post post = new Post();
    Parameter[] params = new Parameter[0];
    expect(mockFb.publish("profileId/feed", Post.class)).andReturn(post);

    // register behavior
    replay(mockFb);

    // readFBClient.fetchObject(id, objectClass);
    Post actualPost = fbRestClient.publishObject("profileId/feed",
        Post.class, params);

    // verify behavior
    verify();
View Full Code Here

TOP

Related Classes of com.restfb.types.Post$Privacy

Copyright © 2018 www.massapicom. 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.