@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 testCollectionWrapsJSONObject() throws JSONException {
    JSONObject jsonLocation = new JSONObject();
    jsonLocation.put("city", "Seattle");

    JSONArray jsonArray = new JSONArray();
    jsonArray.put(jsonLocation);
    Collection<GraphLocation> locationsGraphObjectCollection =
        GraphObject.Factory.createList(jsonArray, GraphLocation.class);
    assertTrue(locationsGraphObjectCollection != null);

    GraphLocation graphLocation = locationsGraphObjectCollection.iterator().next();
    assertTrue(graphLocation != null);
    assertEquals("Seattle", graphLocation.getCity());
  }
  @SmallTest
  @MediumTest
  @LargeTest
  public void testCanCastCollectionOfGraphObjects() throws JSONException {
    JSONObject jsonSeattle = new JSONObject();
    jsonSeattle.put("city", "Seattle");

    JSONArray jsonArray = new JSONArray();
    jsonArray.put(jsonSeattle);

    GraphObjectList<GraphObject> collection =
        GraphObject.Factory.createList(jsonArray, GraphObject.class);

    GraphObjectList<GraphLocation> locationCollection =
        collection.castToListOf(GraphLocation.class);
    assertTrue(locationCollection != null);

    GraphLocation seattle = locationCollection.iterator().next();
    assertTrue(seattle != null);
    assertEquals("Seattle", seattle.getCity());
  }
  @SmallTest
  @MediumTest
  @LargeTest
  public void testCollectionIteratorOfGraphObject() throws JSONException {
    Collection<GraphLocation> collection = GraphObject.Factory.createList(GraphLocation.class);

    GraphLocation seattle = GraphObject.Factory.create(GraphLocation.class);
    seattle.setCity("Seattle");
    collection.add(seattle);
    GraphLocation paris = GraphObject.Factory.create(GraphLocation.class);
    paris.setCity("Paris");
    collection.add(paris);

    Iterator<GraphLocation> iter = collection.iterator();
    assertTrue(iter.hasNext());
    assertEquals(seattle, iter.next());
    assertTrue(iter.hasNext());
    assertEquals(paris, iter.next());
    assertFalse(iter.hasNext());

    for (GraphLocation location : collection) {
      assertTrue(location != null);
    }
  }