Skip to content

Commit

Permalink
Fix and test #69
Browse files Browse the repository at this point in the history
  • Loading branch information
roundrop committed Oct 13, 2014
1 parent 7789f6c commit 04ee9f3
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 4 deletions.
2 changes: 2 additions & 0 deletions facebook4j-core/src/main/java/facebook4j/Page.java
Expand Up @@ -42,4 +42,6 @@ public interface Page {
Boolean isCommunityPage();
Integer getWereHereCount();
Date getCreatedTime();
String getAbout();
String getUsername();
}
Expand Up @@ -30,10 +30,10 @@

/**
* @author Ryuji Yamashita - roundrop at gmail.com
* @since Facebook4J 1.2.0
* @since Facebook4J 2.0.0
*/
/*package*/ final class PageJSONImpl extends FacebookResponseImpl implements Page, java.io.Serializable {
private static final long serialVersionUID = 2058194827423191616L;
private static final long serialVersionUID = -5784064954222183184L;

private String id;
private String name;
Expand Down Expand Up @@ -178,9 +178,13 @@ public Integer getWereHereCount() {
return wereHereCount;
}

public String getAbout() { return about; }
public String getAbout() {
return about;
}

public String getUsername() { return username; }
public String getUsername() {
return username;
}

/*package*/
static ResponseList<Page> createPageList(HttpResponse res, Configuration conf) throws FacebookException {
Expand Down
9 changes: 9 additions & 0 deletions facebook4j-core/src/test/java/facebook4j/PageMethodsTest.java
Expand Up @@ -87,6 +87,15 @@ public void id_reading() throws Exception {
assertThat(page.getId(), is("137246726435626"));
assertThat(page.getName(), is("F4J"));
}

@Test
public void about_and_username() throws Exception {
facebook.setMockJSON("mock_json/page/platform.json");
Page actual = facebook.getPage("platform");

assertThat(actual.getAbout(), is("Build, grow, and monetize your app with Facebook.\nhttps://developers.facebook.com/"));
assertThat(actual.getUsername(), is("FacebookDevelopers"));
}
}

public static class getPagePictureURL extends MockFacebookTestBase {
Expand Down
29 changes: 29 additions & 0 deletions facebook4j-core/src/test/resources/mock_json/page/platform.json
@@ -0,0 +1,29 @@
{
"about": "Build, grow, and monetize your app with Facebook.\nhttps://developers.facebook.com/",
"can_post": false,
"category": "Product/service",
"checkins": 0,
"company_overview": "Visit https://developers.facebook.com for more information on how to build, grow, and monetize your app.\n\nIf you have questions about using Facebook or need help with general inquiries, visit https://www.facebook.com/facebook or our Help Center at http://www.facebook.com/help.\n\nIf you need to report bugs, appeal apps, or ask detailed technical questions, visit the following:\nAppeal Apps: https://developers.facebook.com/appeal\nReport Bugs: http://developers.facebook.com/bugs\nTechnical Questions: http://facebook.stackoverflow.com/",
"cover": {
"cover_id": "10152004458663553",
"offset_x": 0,
"offset_y": 0,
"source": "https://fbcdn-sphotos-c-a.akamaihd.net/hphotos-ak-xap1/v/t1.0-9/s720x720/1466030_10152004458663553_1984809612_n.jpg?oh=97b895edc21d21c0f40a67a6de6077bd&oe=54BBD66C&__gda__=1425132117_907d3a420ffe1d69a5a7e2b6642ba2c3"
},
"has_added_app": false,
"id": "19292868552",
"is_community_page": false,
"is_published": true,
"likes": 3270042,
"link": "https://www.facebook.com/FacebookDevelopers",
"name": "Facebook Developers",
"parking": {
"lot": 0,
"street": 0,
"valet": 0
},
"talking_about_count": 11826,
"username": "FacebookDevelopers",
"website": "http://developers.facebook.com",
"were_here_count": 0
}

0 comments on commit 04ee9f3

Please sign in to comment.