@Test public void itemToPicture__bug3_resize_size_false() throws IOException, JSONException { URL resource = Resources.getResource("get-photo-bug3_resize_size_false.json"); String string = Resources.toString(resource, Charsets.UTF_8); JSONObject jsonResult = (JSONObject) new JSONTokener(string) .nextValue(); Item pictureItem = ItemUtils.parseJSONToItem(jsonResult); Picture itemToPicture = G3ConvertUtils.itemToPicture(pictureItem ); Picture expectedPicture = new Picture(); expectedPicture.setId(502); expectedPicture.setTitle("graduation pics 427"); expectedPicture.setFileName("graduation pics 427.jpg"); expectedPicture.setResizedUrl("http: expectedPicture.setFileUrl("http: expectedPicture.setWidth(2576); expectedPicture.setHeight(1932); expectedPicture.setFileSize(1144458); expectedPicture.setPublicUrl("http: assertEquals(expectedPicture, itemToPicture); }
public static Picture itemToPicture(Item item) { if(item==null ||item.getEntity()==null){ return null; } Picture picture = new Picture(); picture.setId(item.getEntity().getId()); picture.setTitle(item.getEntity().getTitle()); picture.setFileName(item.getEntity().getName()); picture.setThumbUrl(item.getEntity().getThumbUrl()); picture.setThumbWidth(item.getEntity().getThumbWidth()); picture.setThumbHeight(item.getEntity().getThumbHeight()); picture.setThumbSize(item.getEntity().getThumbSize()); picture.setResizedUrl(item.getEntity().getResizeUrl()); picture.setResizedWidth(item.getEntity().getResizeWidth()); picture.setResizedHeight(item.getEntity().getResizeHeight()); picture.setResizedSize(item.getEntity().getResizeSize()); picture.setFileUrl(item.getEntity().getFileUrl()); picture.setFileSize(item.getEntity().getFileSize()); picture.setHeight(item.getEntity().getHeight()); picture.setWidth(item.getEntity().getWidth()); picture.setPublicUrl(item.getEntity().getWebUrl()); return picture; }
G3ConvertUtils { public static Picture itemToPicture(Item item) { if(item==null ||item.getEntity()==null){ return null; } Picture picture = new Picture(); picture.setId(item.getEntity().getId()); picture.setTitle(item.getEntity().getTitle()); picture.setFileName(item.getEntity().getName()); picture.setThumbUrl(item.getEntity().getThumbUrl()); picture.setThumbWidth(item.getEntity().getThumbWidth()); picture.setThumbHeight(item.getEntity().getThumbHeight()); picture.setThumbSize(item.getEntity().getThumbSize()); picture.setResizedUrl(item.getEntity().getResizeUrl()); picture.setResizedWidth(item.getEntity().getResizeWidth()); picture.setResizedHeight(item.getEntity().getResizeHeight()); picture.setResizedSize(item.getEntity().getResizeSize()); picture.setFileUrl(item.getEntity().getFileUrl()); picture.setFileSize(item.getEntity().getFileSize()); picture.setHeight(item.getEntity().getHeight()); picture.setWidth(item.getEntity().getWidth()); picture.setPublicUrl(item.getEntity().getWebUrl()); return picture; } }
G3ConvertUtils { public static Picture itemToPicture(Item item) { if(item==null ||item.getEntity()==null){ return null; } Picture picture = new Picture(); picture.setId(item.getEntity().getId()); picture.setTitle(item.getEntity().getTitle()); picture.setFileName(item.getEntity().getName()); picture.setThumbUrl(item.getEntity().getThumbUrl()); picture.setThumbWidth(item.getEntity().getThumbWidth()); picture.setThumbHeight(item.getEntity().getThumbHeight()); picture.setThumbSize(item.getEntity().getThumbSize()); picture.setResizedUrl(item.getEntity().getResizeUrl()); picture.setResizedWidth(item.getEntity().getResizeWidth()); picture.setResizedHeight(item.getEntity().getResizeHeight()); picture.setResizedSize(item.getEntity().getResizeSize()); picture.setFileUrl(item.getEntity().getFileUrl()); picture.setFileSize(item.getEntity().getFileSize()); picture.setHeight(item.getEntity().getHeight()); picture.setWidth(item.getEntity().getWidth()); picture.setPublicUrl(item.getEntity().getWebUrl()); return picture; }  }
G3ConvertUtils { public static Picture itemToPicture(Item item) { if(item==null ||item.getEntity()==null){ return null; } Picture picture = new Picture(); picture.setId(item.getEntity().getId()); picture.setTitle(item.getEntity().getTitle()); picture.setFileName(item.getEntity().getName()); picture.setThumbUrl(item.getEntity().getThumbUrl()); picture.setThumbWidth(item.getEntity().getThumbWidth()); picture.setThumbHeight(item.getEntity().getThumbHeight()); picture.setThumbSize(item.getEntity().getThumbSize()); picture.setResizedUrl(item.getEntity().getResizeUrl()); picture.setResizedWidth(item.getEntity().getResizeWidth()); picture.setResizedHeight(item.getEntity().getResizeHeight()); picture.setResizedSize(item.getEntity().getResizeSize()); picture.setFileUrl(item.getEntity().getFileUrl()); picture.setFileSize(item.getEntity().getFileSize()); picture.setHeight(item.getEntity().getHeight()); picture.setWidth(item.getEntity().getWidth()); picture.setPublicUrl(item.getEntity().getWebUrl()); return picture; }  static Album itemToAlbum(Item item); static Picture itemToPicture(Item item); }
G3ConvertUtils { public static Picture itemToPicture(Item item) { if(item==null ||item.getEntity()==null){ return null; } Picture picture = new Picture(); picture.setId(item.getEntity().getId()); picture.setTitle(item.getEntity().getTitle()); picture.setFileName(item.getEntity().getName()); picture.setThumbUrl(item.getEntity().getThumbUrl()); picture.setThumbWidth(item.getEntity().getThumbWidth()); picture.setThumbHeight(item.getEntity().getThumbHeight()); picture.setThumbSize(item.getEntity().getThumbSize()); picture.setResizedUrl(item.getEntity().getResizeUrl()); picture.setResizedWidth(item.getEntity().getResizeWidth()); picture.setResizedHeight(item.getEntity().getResizeHeight()); picture.setResizedSize(item.getEntity().getResizeSize()); picture.setFileUrl(item.getEntity().getFileUrl()); picture.setFileSize(item.getEntity().getFileSize()); picture.setHeight(item.getEntity().getHeight()); picture.setWidth(item.getEntity().getWidth()); picture.setPublicUrl(item.getEntity().getWebUrl()); return picture; }  static Album itemToAlbum(Item item); static Picture itemToPicture(Item item);  }