@Test public void getComments_withOffsetAndLimit() { mockServer .expect(requestTo("https://graph.facebook.com/123456/comments?offset=75&limit=100")) .andExpect(method(GET)) .andExpect(header("Authorization", "OAuth someAccessToken")) .andRespond(withSuccess(jsonResource("testdata/comments"), MediaType.APPLICATION_JSON)); List<Comment> comments = facebook.commentOperations().getComments("123456", 75, 100); assertEquals(2, comments.size()); Comment comment1 = comments.get(0); assertEquals("1533260333", comment1.getFrom().getId()); assertEquals("Art Names", comment1.getFrom().getName()); assertEquals("Howdy!", comment1.getMessage()); Comment comment2 = comments.get(1); assertEquals("638140578", comment2.getFrom().getId()); assertEquals("Chuck Wagon", comment2.getFrom().getName()); assertEquals("The world says hello back", comment2.getMessage()); }
/* * This test is for comment "like_count" property after Facebook's breaking change are applied on Sept 5, 2012. * See https://developers.facebook.com/roadmap/#september-2012 * Note that even with the September breaking changes enabled, there are some cases where comments will have a "likes" property instead of "like_count". * This seems like a bug on Facebook's side, but Spring Social Facebook will handle both properties for the time being just in case. */ @Test public void getComment_postSeptember2012BreakingChanges() { mockServer .expect(requestTo("https://graph.facebook.com/1533260333_122829644452184_587062")) .andExpect(method(GET)) .andExpect(header("Authorization", "OAuth someAccessToken")) .andRespond(withSuccess(jsonResource("testdata/comment"), MediaType.APPLICATION_JSON)); Comment comment = facebook.commentOperations().getComment("1533260333_122829644452184_587062"); assertEquals("1533260333", comment.getFrom().getId()); assertEquals("Art Names", comment.getFrom().getName()); assertEquals("Howdy!", comment.getMessage()); assertNull(comment.getLikes()); assertEquals(4, comment.getLikesCount()); }