GraphObjectFactoryTests.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:LostAndFound 作者:
@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());
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号