/** * Can we handle a full stream.publish example? * * <p>See http://wiki.developers.facebook.com/index.php/Attachment_(Streams). */ @Test public void streamPublish() throws JSONException { ActionLink category = new ActionLink(); category.href = "http://bit.ly/KYbaN"; category.text = "humor"; Properties properties = new Properties(); properties.category = category; properties.ratings = "5 stars"; Medium medium = new Medium(); medium.href = "http://bit.ly/187gO1"; medium.src = "http://icanhascheezburger.files.wordpress.com/2009/03/funny-pictures-your-cat-is-bursting-with-joy1.jpg"; medium.type = "image"; List<Medium> media = new ArrayList<Medium>(); media.add(medium); Attachment attachment = new Attachment(); attachment.name = "i'm bursting with joy"; attachment.href = "http://bit.ly/187gO1"; attachment.caption = "{*actor*} rated the lolcat 5 stars"; attachment.description = "a funny looking cat"; attachment.properties = properties; attachment.media = media; String json = createJsonMapper().toJson(attachment); String expectedJson = "{\"description\":\"a funny looking cat\",\"name\":\"i'm bursting with joy\",\"caption\":\"{*actor*} rated the lolcat 5 stars\",\"properties\":{\"category\":{\"text\":\"humor\",\"href\":\"http://bit.ly/KYbaN\"},\"ratings\":\"5 stars\"},\"media\":[{\"src\":\"http://icanhascheezburger.files.wordpress.com/2009/03/funny-pictures-your-cat-is-bursting-with-joy1.jpg\",\"type\":\"image\",\"href\":\"http://bit.ly/187gO1\"}],\"href\":\"http://bit.ly/187gO1\"}"; JSONAssert.assertEquals(expectedJson, json, JSONCompareMode.NON_EXTENSIBLE); }