/** Build user's info to display on the screen */
  private String buildUserInfoDisplay(GraphUser user) {
    StringBuilder userInfo = new StringBuilder("");

    /** (name) - no special permissions required */
    userInfo.append(String.format("Name: %s\n", user.getName()));

    /** (birthday) - requires user_birthday permission */
    userInfo.append(String.format("Birthday: %s\n", user.getBirthday()));

    /** (location) - requires user_location permission */
    GraphPlace location = user.getLocation();
    if (location != null) {
      userInfo.append(String.format("Location: %s\n", location.getProperty("name")));
    }

    /** (locale) - no special permissions required */
    userInfo.append(String.format("Locale: %s\n", user.getProperty("locale")));

    /** (languages) - requires user_likes permission. */
    JSONArray languages = (JSONArray) user.getProperty("languages");
    if (languages != null && languages.length() > 0) {
      ArrayList<String> languageNames = new ArrayList<String>();
      for (int i = 0; i < languages.length(); i++) {
        JSONObject language = languages.optJSONObject(i);
        languageNames.add(language.optString("name"));
      }
      userInfo.append(String.format("Languages: %s\n", languageNames.toString()));
    }
    return userInfo.toString();
  }
  @SmallTest
  @MediumTest
  @LargeTest
  public void testCanTreatAsGraphPlace() {
    GraphPlace graphPlace = GraphObject.Factory.create(GraphPlace.class);

    graphPlace.setName("hello");
    assertEquals("hello", graphPlace.getName());
  }
  @SmallTest
  @MediumTest
  @LargeTest
  public void testSettingGraphObjectProxyStoresJSONObject() throws JSONException {
    GraphPlace graphPlace = GraphObject.Factory.create(GraphPlace.class);
    GraphLocation graphLocation = GraphObject.Factory.create(GraphLocation.class);

    graphPlace.setLocation(graphLocation);

    assertEquals(
        graphLocation.getInnerJSONObject(), graphPlace.getInnerJSONObject().get("location"));
  }
  @SmallTest
  @MediumTest
  @LargeTest
  public void testCanSetComplexTypes() {
    GraphLocation graphLocation = GraphObject.Factory.create(GraphLocation.class);
    graphLocation.setCity("Seattle");

    GraphPlace graphPlace = GraphObject.Factory.create(GraphPlace.class);
    graphPlace.setLocation(graphLocation);

    assertEquals(graphLocation, graphPlace.getLocation());
    assertEquals("Seattle", graphPlace.getLocation().getCity());
  }
  @SmallTest
  @MediumTest
  @LargeTest
  public void testCanConvertFromGraphObject() throws JSONException {
    GraphObject graphObject = GraphObject.Factory.create();
    graphObject.setProperty("city", "Paris");
    graphObject.setProperty("country", "France");

    JSONObject jsonPlace = new JSONObject();
    jsonPlace.put("location", graphObject);
    jsonPlace.put("name", "Eiffel Tower");

    GraphPlace graphPlace = GraphObject.Factory.create(jsonPlace, GraphPlace.class);
    GraphLocation graphLocation = graphPlace.getLocation();
    assertEquals("Paris", graphLocation.getCity());
  }
  @SmallTest
  @MediumTest
  @LargeTest
  public void testObjectEquals() {
    GraphObject graphObject = GraphObject.Factory.create();
    graphObject.setProperty("aKey", "aValue");

    assertTrue(graphObject.equals(graphObject));

    GraphPlace graphPlace = graphObject.cast(GraphPlace.class);
    assertTrue(graphObject.equals(graphPlace));
    assertTrue(graphPlace.equals(graphObject));

    GraphObject aDifferentGraphObject = GraphObject.Factory.create();
    aDifferentGraphObject.setProperty("aKey", "aDifferentValue");
    assertFalse(graphObject.equals(aDifferentGraphObject));
  }