(android.content.Context, android.util.AttributeSet, int);
27 | }
28 |
29 | -keepclassmembers class * extends android.app.Activity {
30 | public void *(android.view.View);
31 | }
32 |
33 | -keepclassmembers enum * {
34 | public static **[] values();
35 | public static ** valueOf(java.lang.String);
36 | }
37 |
38 | -keep class * implements android.os.Parcelable {
39 | public static final android.os.Parcelable$Creator *;
40 | }
41 |
--------------------------------------------------------------------------------
/test/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Project target.
11 | target=android-7
12 |
--------------------------------------------------------------------------------
/test/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeremyhaberman/restful-android/181aa5a232c0b27d3f41944bdc3907516e9b3697/test/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/test/res/drawable-ldpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeremyhaberman/restful-android/181aa5a232c0b27d3f41944bdc3907516e9b3697/test/res/drawable-ldpi/ic_launcher.png
--------------------------------------------------------------------------------
/test/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeremyhaberman/restful-android/181aa5a232c0b27d3f41944bdc3907516e9b3697/test/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/test/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/test/res/raw/timeline_response.json:
--------------------------------------------------------------------------------
1 | [{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"id_str":"166345563783168000","user":{"follow_request_sent":false,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1797958142\/bf_normal.jpg","lang":"es","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/414765232\/goodfriends.jpg","profile_background_color":"ffffff","url":null,"name":"Manuel Acosta","default_profile_image":false,"contributors_enabled":false,"profile_background_tile":true,"friends_count":208,"utc_offset":-28800,"favourites_count":23,"profile_sidebar_fill_color":"173180","description":"","id_str":"326302406","is_translator":false,"show_all_inline_media":false,"created_at":"Wed Jun 29 18:06:11 +0000 2011","profile_sidebar_border_color":"000000","following":false,"screen_name":"ManuelAcosta10","listed_count":0,"statuses_count":1280,"profile_use_background_image":true,"time_zone":"Pacific Time (US & Canada)","verified":false,"geo_enabled":true,"notifications":false,"profile_text_color":"000000","followers_count":103,"profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/1797958142\/bf_normal.jpg","default_profile":false,"profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/414765232\/goodfriends.jpg","id":326302406,"profile_link_color":"a10000","location":"London, UK"},"created_at":"Mon Feb 06 02:20:47 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"\u003Ca href=\"http:\/\/twitter.com\/#!\/download\/iphone\" rel=\"nofollow\"\u003ETwitter for iPhone\u003C\/a\u003E","id":166345563783168000,"in_reply_to_user_id_str":null,"text":"Brady time! Vamos por otro touchdown"},{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"id_str":"166345563367936000","user":{"follow_request_sent":null,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1435521982\/Photo_585_normal.jpg","lang":"en","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/379548776\/andy_gilmore_09-27-2011.jpg","profile_background_color":"DBE9ED","url":"http:\/\/www.last.fm\/user\/technopop","name":"vanessa crandall","default_profile_image":false,"contributors_enabled":false,"profile_background_tile":true,"friends_count":157,"utc_offset":-18000,"favourites_count":211,"profile_sidebar_fill_color":"E6F6F9","description":"Audiology student, sports fan, design enthusiast. Plus: bourbon, Sweden, nerdery, and lamps.","id_str":"92272047","is_translator":false,"show_all_inline_media":true,"created_at":"Tue Nov 24 13:28:16 +0000 2009","profile_sidebar_border_color":"DBE9ED","following":null,"screen_name":"vancran","listed_count":1,"statuses_count":1846,"profile_use_background_image":true,"time_zone":"Eastern Time (US & Canada)","verified":false,"geo_enabled":false,"notifications":null,"profile_text_color":"333333","followers_count":44,"profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1435521982\/Photo_585_normal.jpg","default_profile":false,"profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/379548776\/andy_gilmore_09-27-2011.jpg","id":92272047,"profile_link_color":"CC3366","location":"toronto and london"},"created_at":"Mon Feb 06 02:20:47 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"web","id":166345563367936000,"in_reply_to_user_id_str":null,"text":"OH MY GOD WHAT IS THIS SAMSUNG GALAXY COMMERCIAL MY MIND IS BLOWN"},{"coordinates":null,"retweet_count":1,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"id_str":"166345562210304000","user":{"follow_request_sent":null,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1806986835\/simpsons_normal.jpg","lang":"en","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/405929212\/tumblr_lx7bjwGaQa1qegssko1_500.jpg","profile_background_color":"06A0ED","url":"http:\/\/www.facebook.com\/profile.php?id=1454164014","name":"\u06e9 The Real KBJ33 \u06e9 \u00a9","default_profile_image":false,"contributors_enabled":false,"profile_background_tile":true,"friends_count":278,"utc_offset":-25200,"favourites_count":488,"profile_sidebar_fill_color":"090A0A","description":"#TeamFreakInMe, #TeamHoopOrDie, TeamMoneyOverBullshit, #TeamAndorid, Wifey @Scream_Help 3 \r\n","id_str":"230618248","is_translator":false,"show_all_inline_media":false,"created_at":"Sun Dec 26 04:16:50 +0000 2010","profile_sidebar_border_color":"09A4F2","following":null,"screen_name":"TeamGotGroupies","listed_count":5,"statuses_count":9469,"profile_use_background_image":true,"time_zone":"Mountain Time (US & Canada)","verified":false,"geo_enabled":false,"notifications":null,"profile_text_color":"050505","followers_count":1087,"profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/1806986835\/simpsons_normal.jpg","default_profile":false,"profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/405929212\/tumblr_lx7bjwGaQa1qegssko1_500.jpg","id":230618248,"profile_link_color":"06B9FA","location":"Illinois"},"created_at":"Mon Feb 06 02:20:47 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"web","id":166345562210304000,"in_reply_to_user_id_str":null,"text":"I Love Tight And Long Hugs <3"},{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"id_str":"166345560855552000","user":{"follow_request_sent":null,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1143981421\/UtahUSAWLogo_normal.jpg","lang":"en","profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_color":"C0DEED","url":"http:\/\/www.wrestleutah.com","name":"USA Wrestling Utah","default_profile_image":false,"contributors_enabled":false,"profile_background_tile":false,"friends_count":48,"utc_offset":-25200,"favourites_count":0,"profile_sidebar_fill_color":"DDEEF6","description":"Non-profit affiliated with the National Olympic Governing Body of wrestling, USA Wrestling. We manage memberships. Overseeing competitions, training, and Teams!","id_str":"202249887","is_translator":false,"show_all_inline_media":false,"created_at":"Wed Oct 13 16:39:21 +0000 2010","profile_sidebar_border_color":"C0DEED","following":null,"screen_name":"USAwrestlingUT","listed_count":1,"statuses_count":583,"profile_use_background_image":true,"time_zone":"Mountain Time (US & Canada)","verified":false,"geo_enabled":false,"notifications":null,"profile_text_color":"333333","followers_count":104,"profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1143981421\/UtahUSAWLogo_normal.jpg","default_profile":true,"profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme1\/bg.png","id":202249887,"profile_link_color":"0084B4","location":""},"created_at":"Mon Feb 06 02:20:46 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"\u003Ca href=\"http:\/\/twitter.com\/download\/android\" rel=\"nofollow\"\u003ETwitter for Android\u003C\/a\u003E","id":166345560855552000,"in_reply_to_user_id_str":null,"text":"Congratulations to Champions for winning the Utah Super State Championships! Mettle came 2nd and Payson came 3rd"},{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"id_str":"166345560025088000","user":{"follow_request_sent":null,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1555492239\/309368_189372574467425_100001840511581_456239_370525906_n_normal.jpg","lang":"pt","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/61111892\/bandeira-do-rs-copy.jpg","profile_background_color":"C0DEED","url":null,"name":"Gabriel Dutra","default_profile_image":false,"contributors_enabled":false,"profile_background_tile":true,"friends_count":567,"utc_offset":-10800,"favourites_count":20,"profile_sidebar_fill_color":"DDEEF6","description":"","id_str":"75697164","is_translator":false,"show_all_inline_media":true,"created_at":"Sun Sep 20 02:11:57 +0000 2009","profile_sidebar_border_color":"C0DEED","following":null,"screen_name":"dutra_gabriel","listed_count":10,"statuses_count":39508,"profile_use_background_image":true,"time_zone":"Greenland","verified":false,"geo_enabled":true,"notifications":null,"profile_text_color":"333333","followers_count":568,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1555492239\/309368_189372574467425_100001840511581_456239_370525906_n_normal.jpg","default_profile":false,"profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/61111892\/bandeira-do-rs-copy.jpg","id":75697164,"profile_link_color":"0084B4","location":"Sudamerica"},"created_at":"Mon Feb 06 02:20:46 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"\u003Ca href=\"http:\/\/mobile.twitter.com\" rel=\"nofollow\"\u003EMobile Web\u003C\/a\u003E","id":166345560025088000,"in_reply_to_user_id_str":null,"text":"T\u00e1 dando o Super Bowl ainda, vou ligar e ver uma coisa que n\u00e3o seja relacionada ao Rodeio...haha"},{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"possibly_sensitive":false,"id_str":"166345559916032000","user":{"follow_request_sent":null,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1620316286\/P1090503_normal.JPG","lang":"en","profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_color":"C0DEED","url":null,"name":"MFrost","default_profile_image":false,"contributors_enabled":false,"profile_background_tile":false,"friends_count":167,"utc_offset":-18000,"favourites_count":0,"profile_sidebar_fill_color":"DDEEF6","description":"","id_str":"404064505","is_translator":false,"show_all_inline_media":false,"created_at":"Thu Nov 03 11:49:06 +0000 2011","profile_sidebar_border_color":"C0DEED","following":null,"screen_name":"MFrost3","listed_count":14,"statuses_count":23242,"profile_use_background_image":true,"time_zone":"Eastern Time (US & Canada)","verified":false,"geo_enabled":false,"notifications":null,"profile_text_color":"333333","followers_count":186,"profile_image_url":"http:\/\/a1.twimg.com\/profile_images\/1620316286\/P1090503_normal.JPG","default_profile":true,"profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme1\/bg.png","id":404064505,"profile_link_color":"0084B4","location":""},"created_at":"Mon Feb 06 02:20:46 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"\u003Ca href=\"http:\/\/www.socialoomph.com\" rel=\"nofollow\"\u003ESocialOomph\u003C\/a\u003E","id":166345559916032000,"in_reply_to_user_id_str":null,"text":"This is a #Photo of #Three #Seagulls #Standing around-#Birds\thttp:\/\/t.co\/6HJRKtBK"},{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"id_str":"166345559282688000","user":{"follow_request_sent":null,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1687836975\/SAM_0359_normal.JPG","lang":"pt","profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_color":"C0DEED","url":null,"name":"JeaAnN ","default_profile_image":false,"contributors_enabled":false,"profile_background_tile":false,"friends_count":39,"utc_offset":null,"favourites_count":0,"profile_sidebar_fill_color":"DDEEF6","description":"","id_str":"344364712","is_translator":false,"show_all_inline_media":false,"created_at":"Thu Jul 28 23:27:01 +0000 2011","profile_sidebar_border_color":"C0DEED","following":null,"screen_name":"pajezinhoo","listed_count":0,"statuses_count":612,"profile_use_background_image":true,"time_zone":null,"verified":false,"geo_enabled":false,"notifications":null,"profile_text_color":"333333","followers_count":34,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1687836975\/SAM_0359_normal.JPG","default_profile":true,"profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme1\/bg.png","id":344364712,"profile_link_color":"0084B4","location":""},"created_at":"Mon Feb 06 02:20:46 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"\u003Ca href=\"http:\/\/mobile.twitter.com\" rel=\"nofollow\"\u003EMobile Web\u003C\/a\u003E","id":166345559282688000,"in_reply_to_user_id_str":null,"text":"Mama eu mama eu, mama mama eu ... =)"},{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"id_str":"166345558452224000","user":{"follow_request_sent":null,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1434388550\/PQAAAKbsd4lZpWrFLRbUy71a97ma0weXDjdgz8TnZvBxdy5G4OBrM8GJ5pBSpxWh1YYPmfjMYSGMUIZZ36yI4HWbDykAm1T1UDnt-jKrCbIza8BTBv2M_uj3ELsV_normal.jpg","lang":"pt","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/414525434\/kkkkkkk.jpg","profile_background_color":"131516","url":null,"name":"Lucas Siqueira .","default_profile_image":false,"contributors_enabled":false,"profile_background_tile":true,"friends_count":79,"utc_offset":-14400,"favourites_count":0,"profile_sidebar_fill_color":"efefef","description":"qu\u00e9 sabe, tudo tem um porque, to legal quero mais \u00e9 viver !","id_str":"280311781","is_translator":false,"show_all_inline_media":false,"created_at":"Mon Apr 11 02:45:26 +0000 2011","profile_sidebar_border_color":"eeeeee","following":null,"screen_name":"lucasluzs","listed_count":0,"statuses_count":10328,"profile_use_background_image":true,"time_zone":"Santiago","verified":false,"geo_enabled":true,"notifications":null,"profile_text_color":"333333","followers_count":216,"profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1434388550\/PQAAAKbsd4lZpWrFLRbUy71a97ma0weXDjdgz8TnZvBxdy5G4OBrM8GJ5pBSpxWh1YYPmfjMYSGMUIZZ36yI4HWbDykAm1T1UDnt-jKrCbIza8BTBv2M_uj3ELsV_normal.jpg","default_profile":false,"profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/414525434\/kkkkkkk.jpg","id":280311781,"profile_link_color":"009999","location":""},"created_at":"Mon Feb 06 02:20:46 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"\u003Ca href=\"http:\/\/mobile.twitter.com\" rel=\"nofollow\"\u003EMobile Web\u003C\/a\u003E","id":166345558452224000,"in_reply_to_user_id_str":null,"text":"ent\u00e3o vou tomar banho e durmir !"},{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"id_str":"166345557076480000","user":{"follow_request_sent":null,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1678249204\/image_normal.jpg","lang":"en","profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_color":"C0DEED","url":null,"name":"Dalt","default_profile_image":false,"contributors_enabled":false,"profile_background_tile":false,"friends_count":144,"utc_offset":-28800,"favourites_count":0,"profile_sidebar_fill_color":"DDEEF6","description":"I Dont Overthink Things","id_str":"352833610","is_translator":false,"show_all_inline_media":false,"created_at":"Thu Aug 11 04:09:54 +0000 2011","profile_sidebar_border_color":"C0DEED","following":null,"screen_name":"BigD_NotDallas","listed_count":0,"statuses_count":1663,"profile_use_background_image":true,"time_zone":"Pacific Time (US & Canada)","verified":false,"geo_enabled":false,"notifications":null,"profile_text_color":"333333","followers_count":149,"profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1678249204\/image_normal.jpg","default_profile":true,"profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme1\/bg.png","id":352833610,"profile_link_color":"0084B4","location":null},"created_at":"Mon Feb 06 02:20:46 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"\u003Ca href=\"http:\/\/twitter.com\/#!\/download\/iphone\" rel=\"nofollow\"\u003ETwitter for iPhone\u003C\/a\u003E","id":166345557076480000,"in_reply_to_user_id_str":null,"text":"This nigga @slim_SHANE_y has the same twit pic with a different face"},{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"possibly_sensitive":false,"id_str":"166345556879360000","user":{"follow_request_sent":null,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1682114818\/image_normal.jpg","lang":"en","profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme9\/bg.gif","profile_background_color":"1a1b1c","url":"http:\/\/www.noob.us","name":"Quinn smith","default_profile_image":false,"contributors_enabled":false,"profile_background_tile":false,"friends_count":187,"utc_offset":-18000,"favourites_count":48,"profile_sidebar_fill_color":"252429","description":"Rule #32. Enjoy the little things","id_str":"285737661","is_translator":false,"show_all_inline_media":false,"created_at":"Thu Apr 21 17:59:03 +0000 2011","profile_sidebar_border_color":"181A1E","following":null,"screen_name":"Kwnsmith","listed_count":0,"statuses_count":8086,"profile_use_background_image":true,"time_zone":"Quito","verified":false,"geo_enabled":false,"notifications":null,"profile_text_color":"d60b0b","followers_count":245,"profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1682114818\/image_normal.jpg","default_profile":false,"profile_background_image_url":"http:\/\/a1.twimg.com\/images\/themes\/theme9\/bg.gif","id":285737661,"profile_link_color":"0091ff","location":""},"created_at":"Mon Feb 06 02:20:45 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"\u003Ca href=\"http:\/\/instagr.am\" rel=\"nofollow\"\u003EInstagram\u003C\/a\u003E","id":166345556879360000,"in_reply_to_user_id_str":null,"text":"Totally remember laughing my ass off in this episode! http:\/\/t.co\/MqJC4qWB"},{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"id_str":"166345556661248000","user":{"follow_request_sent":null,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1799660513\/405442_177851778987370_100002876480481_232293_1646307804_n_normal.jpg","lang":"en","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/357738830\/371167_769398691_882872272_n.jpg","profile_background_color":"C0DEED","url":null,"name":"ZEE","default_profile_image":false,"contributors_enabled":false,"profile_background_tile":true,"friends_count":328,"utc_offset":-18000,"favourites_count":1,"profile_sidebar_fill_color":"DDEEF6","description":" Juelz&Sincir Mommy and a Hairstylist HE #BLESSED me ....what more can i ask for...#SMOOCHIES!","id_str":"64771222","is_translator":false,"show_all_inline_media":false,"created_at":"Tue Aug 11 17:18:08 +0000 2009","profile_sidebar_border_color":"C0DEED","following":null,"screen_name":"ZEEtheSTYLIST","listed_count":1,"statuses_count":8048,"profile_use_background_image":true,"time_zone":"Eastern Time (US & Canada)","verified":false,"geo_enabled":false,"notifications":null,"profile_text_color":"333333","followers_count":217,"profile_image_url":"http:\/\/a1.twimg.com\/profile_images\/1799660513\/405442_177851778987370_100002876480481_232293_1646307804_n_normal.jpg","default_profile":false,"profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/357738830\/371167_769398691_882872272_n.jpg","id":64771222,"profile_link_color":"0084B4","location":"StyleVILLE,DC"},"created_at":"Mon Feb 06 02:20:45 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"\u003Ca href=\"http:\/\/levelupstudio.com\/plume\" rel=\"nofollow\"\u003EPlume\u00a0for\u00a0Android\u003C\/a\u003E","id":166345556661248000,"in_reply_to_user_id_str":null,"text":"\u201c@MsRicka \u201c@BossBitchFacts I dont talk shit, I state facts! #BossBitchFacts\u201d\u201d"},{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"id_str":"166345556136960000","user":{"follow_request_sent":null,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1791337589\/Foto0201_normal.jpg","lang":"es","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/364264570\/212-vip-400x300.jpg","profile_background_color":"C0DEED","url":null,"name":"Gianna Villarroel","default_profile_image":false,"contributors_enabled":false,"profile_background_tile":true,"friends_count":139,"utc_offset":-14400,"favourites_count":0,"profile_sidebar_fill_color":"DDEEF6","description":"All goes well in the end, if it is not well, it is not the end.","id_str":"178943475","is_translator":false,"show_all_inline_media":false,"created_at":"Mon Aug 16 02:50:08 +0000 2010","profile_sidebar_border_color":"C0DEED","following":null,"screen_name":"giannu_vg","listed_count":0,"statuses_count":332,"profile_use_background_image":true,"time_zone":"Santiago","verified":false,"geo_enabled":false,"notifications":null,"profile_text_color":"333333","followers_count":61,"profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1791337589\/Foto0201_normal.jpg","default_profile":false,"profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/364264570\/212-vip-400x300.jpg","id":178943475,"profile_link_color":"0084B4","location":""},"created_at":"Mon Feb 06 02:20:45 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"web","id":166345556136960000,"in_reply_to_user_id_str":null,"text":"jajajajajajjajajajajajaajaja"},{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"id_str":"166345555503616000","user":{"follow_request_sent":null,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/706737685\/amauy_dumbo_normal.jpg","lang":"en","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/80060306\/amaury_dumbo_2.jpg","profile_background_color":"C0DEED","url":null,"name":"Amaury Dumbo","default_profile_image":false,"contributors_enabled":false,"profile_background_tile":true,"friends_count":171,"utc_offset":-10800,"favourites_count":2,"profile_sidebar_fill_color":"DDEEF6","description":"Meu amigooooooooooooo","id_str":"112964878","is_translator":false,"show_all_inline_media":false,"created_at":"Wed Feb 10 07:53:03 +0000 2010","profile_sidebar_border_color":"C0DEED","following":null,"screen_name":"Amaury_Dumbo_","listed_count":60,"statuses_count":7670,"profile_use_background_image":true,"time_zone":"Greenland","verified":false,"geo_enabled":false,"notifications":null,"profile_text_color":"333333","followers_count":2147,"profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/706737685\/amauy_dumbo_normal.jpg","default_profile":false,"profile_background_image_url":"http:\/\/a1.twimg.com\/profile_background_images\/80060306\/amaury_dumbo_2.jpg","id":112964878,"profile_link_color":"0084B4","location":"Brazil"},"created_at":"Mon Feb 06 02:20:45 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"web","id":166345555503616000,"in_reply_to_user_id_str":null,"text":"Eu estava aonde??? RT @sigapiovani dumbo was there."},{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"possibly_sensitive":false,"id_str":"166345555394560000","user":{"follow_request_sent":null,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1790054568\/image_normal.jpg","lang":"en","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/389353512\/fuck-you-its-magic-4681-500-399.jpg","profile_background_color":"06000a","url":null,"name":"Psycho\ue241Lette","default_profile_image":false,"contributors_enabled":false,"profile_background_tile":true,"friends_count":376,"utc_offset":-21600,"favourites_count":5,"profile_sidebar_fill_color":"000508","description":"My tweets speak for themselves! ","id_str":"186639003","is_translator":false,"show_all_inline_media":false,"created_at":"Sat Sep 04 00:20:43 +0000 2010","profile_sidebar_border_color":"65B0DA","following":null,"screen_name":"BazkitC8s","listed_count":18,"statuses_count":24877,"profile_use_background_image":true,"time_zone":"Central Time (US & Canada)","verified":false,"geo_enabled":false,"notifications":null,"profile_text_color":"410b5c","followers_count":430,"profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1790054568\/image_normal.jpg","default_profile":false,"profile_background_image_url":"http:\/\/a1.twimg.com\/profile_background_images\/389353512\/fuck-you-its-magic-4681-500-399.jpg","id":186639003,"profile_link_color":"ff0000","location":"KCMO"},"created_at":"Mon Feb 06 02:20:45 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"\u003Ca href=\"http:\/\/itunes.apple.com\/jp\/app\/twitpict\/id316845459?mt=8\" rel=\"nofollow\"\u003ETwitPict\u003C\/a\u003E","id":166345555394560000,"in_reply_to_user_id_str":null,"text":"My purple rope http:\/\/t.co\/UpgXMMeg"},{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"id_str":"166345554455040000","user":{"follow_request_sent":null,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1730601703\/PhotoChooser-5127ceb1-2a9a-4e29-81c1-0bd27e2ce585_normal.jpg","lang":"en","profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_color":"5c595e","url":null,"name":"Autumn Wedding","default_profile_image":false,"contributors_enabled":false,"profile_background_tile":false,"friends_count":100,"utc_offset":-21600,"favourites_count":4,"profile_sidebar_fill_color":"000000","description":" #TeamNoSleep #TeamBBN #StillBlazin","id_str":"380640044","is_translator":false,"show_all_inline_media":false,"created_at":"Tue Sep 27 00:15:13 +0000 2011","profile_sidebar_border_color":"000000","following":null,"screen_name":"Baaahhtaahhhdd","listed_count":0,"statuses_count":655,"profile_use_background_image":true,"time_zone":"Central Time (US & Canada)","verified":false,"geo_enabled":false,"notifications":null,"profile_text_color":"05dceb","followers_count":108,"profile_image_url":"http:\/\/a1.twimg.com\/profile_images\/1730601703\/PhotoChooser-5127ceb1-2a9a-4e29-81c1-0bd27e2ce585_normal.jpg","default_profile":false,"profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme1\/bg.png","id":380640044,"profile_link_color":"151fdb","location":""},"created_at":"Mon Feb 06 02:20:45 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"\u003Ca href=\"http:\/\/twitter.com\/devices\" rel=\"nofollow\"\u003Etxt\u003C\/a\u003E","id":166345554455040000,"in_reply_to_user_id_str":null,"text":"mom: Im gunna set up a camera, \ndad: in your vagina?\nbrother: Why so you can see all the peckers that go in it?"},{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"id_str":"166345553406464000","user":{"follow_request_sent":null,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1743997945\/image_normal.jpg","lang":"en","profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_color":"C0DEED","url":"http:\/\/www.doctordoctorgivemethenews.org","name":"Alec Ward","default_profile_image":false,"contributors_enabled":false,"profile_background_tile":false,"friends_count":86,"utc_offset":null,"favourites_count":3,"profile_sidebar_fill_color":"DDEEF6","description":"Car Washer, Time Traveler, Ghost Buster and NOT a Doctor. Just to make sure. This is officialy the official twitter page of officiality for Alec Ward.","id_str":"137694269","is_translator":false,"show_all_inline_media":false,"created_at":"Tue Apr 27 13:26:35 +0000 2010","profile_sidebar_border_color":"C0DEED","following":null,"screen_name":"thealecward","listed_count":0,"statuses_count":1035,"profile_use_background_image":true,"time_zone":null,"verified":false,"geo_enabled":false,"notifications":null,"profile_text_color":"333333","followers_count":41,"profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1743997945\/image_normal.jpg","default_profile":true,"profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme1\/bg.png","id":137694269,"profile_link_color":"0084B4","location":"Duckberg, USA"},"created_at":"Mon Feb 06 02:20:45 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"\u003Ca href=\"http:\/\/twitter.com\/#!\/download\/iphone\" rel=\"nofollow\"\u003ETwitter for iPhone\u003C\/a\u003E","id":166345553406464000,"in_reply_to_user_id_str":null,"text":"The Giants are losing players left and right! Where was the interference call??!??!?"},{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"id_str":"166345553297408000","user":{"follow_request_sent":null,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1788594000\/ferfer_normal.jpg","lang":"pt","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/414726458\/as_estrelas_piscam.jpg","profile_background_color":"ffffff","url":"http:\/\/myheartneeds-y0u.tumblr.com\/","name":"fe fere fefe","default_profile_image":false,"contributors_enabled":false,"profile_background_tile":true,"friends_count":174,"utc_offset":-10800,"favourites_count":1,"profile_sidebar_fill_color":"","description":"aprendi a carregar meu pr\u00f3prio peso pra n\u00e3o ser um peso a mais nas costas de ningu\u00e9m - Rashid.","id_str":"167477896","is_translator":false,"show_all_inline_media":false,"created_at":"Fri Jul 16 17:59:40 +0000 2010","profile_sidebar_border_color":"ffffff","following":null,"screen_name":"ferlouzz","listed_count":1,"statuses_count":11197,"profile_use_background_image":true,"time_zone":"Brasilia","verified":false,"geo_enabled":false,"notifications":null,"profile_text_color":"0a0a0a","followers_count":191,"profile_image_url":"http:\/\/a1.twimg.com\/profile_images\/1788594000\/ferfer_normal.jpg","default_profile":false,"profile_background_image_url":"http:\/\/a1.twimg.com\/profile_background_images\/414726458\/as_estrelas_piscam.jpg","id":167477896,"profile_link_color":"ff059b","location":"cedabliobe"},"created_at":"Mon Feb 06 02:20:45 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"web","id":166345553297408000,"in_reply_to_user_id_str":null,"text":"FRIO SEU LINDO PODE APARECER N\u00c3O SEJA T\u00cdMIDO"},{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"id_str":"166345552991232000","user":{"follow_request_sent":null,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1785627647\/405254_262139993855700_100001791057675_621453_142435963_n_normal.jpg","lang":"en","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/404611246\/6a00d834cdafac69e20115722113ff970b-500wi.jpg","profile_background_color":"7ad6a9","url":"http:\/\/valesquise.tumblr.com\/","name":"Valeria de la Rose","default_profile_image":false,"contributors_enabled":false,"profile_background_tile":true,"friends_count":225,"utc_offset":-25200,"favourites_count":247,"profile_sidebar_fill_color":"f7b166","description":"Don't be a bore! Be a whore!\u2665","id_str":"116335001","is_translator":false,"show_all_inline_media":true,"created_at":"Mon Feb 22 02:54:02 +0000 2010","profile_sidebar_border_color":"f5ef47","following":null,"screen_name":"ValEsquise","listed_count":2,"statuses_count":9458,"profile_use_background_image":true,"time_zone":"Arizona","verified":false,"geo_enabled":true,"notifications":null,"profile_text_color":"f50cc6","followers_count":345,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1785627647\/405254_262139993855700_100001791057675_621453_142435963_n_normal.jpg","default_profile":false,"profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/404611246\/6a00d834cdafac69e20115722113ff970b-500wi.jpg","id":116335001,"profile_link_color":"6d54ab","location":"Where the sky ends."},"created_at":"Mon Feb 06 02:20:45 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"\u003Ca href=\"http:\/\/blackberry.com\/twitter\" rel=\"nofollow\"\u003ETwitter for BlackBerry\u00ae\u003C\/a\u003E","id":166345552991232000,"in_reply_to_user_id_str":null,"text":"Josefina V Mota gana la candidatura del PAN, nada mas les aviso q esa est\u00fapida piensa privatizar la educaci\u00f3n."},{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"id_str":"166345552576000000","user":{"id":334162573,"profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1754601441\/image_normal.jpg","verified":false,"followers_count":28,"following":null,"default_profile_image":false,"profile_background_image_url":"http:\/\/a1.twimg.com\/images\/themes\/theme17\/bg.gif","geo_enabled":true,"url":null,"id_str":"334162573","profile_link_color":"CC3366","statuses_count":1709,"favourites_count":1,"utc_offset":-21600,"name":"Diana Edith Garcia","profile_use_background_image":true,"profile_text_color":"333333","time_zone":"Central Time (US & Canada)","created_at":"Tue Jul 12 17:32:46 +0000 2011","protected":false,"location":"Houston tx","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1754601441\/image_normal.jpg","default_profile":false,"profile_sidebar_border_color":"DBE9ED","is_translator":false,"description":"Spontaneous, loving, caring, crazy, loud, classy, love the color pink \ue328","notifications":null,"profile_background_tile":false,"contributors_enabled":false,"lang":"en","listed_count":0,"friends_count":58,"profile_sidebar_fill_color":"E6F6F9","follow_request_sent":null,"profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme17\/bg.gif","show_all_inline_media":true,"screen_name":"garciadiana1","profile_background_color":"DBE9ED"},"created_at":"Mon Feb 06 02:20:44 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"\u003Ca href=\"http:\/\/twitter.com\/download\/android\" rel=\"nofollow\"\u003ETwitter for Android\u003C\/a\u003E","id":166345552576000000,"in_reply_to_user_id_str":null,"text":"Yay I won $15 bucks! Hey something is something! ;p"},{"coordinates":null,"retweet_count":0,"in_reply_to_screen_name":null,"in_reply_to_status_id":null,"contributors":null,"place":null,"in_reply_to_user_id":null,"geo":null,"truncated":false,"possibly_sensitive":false,"id_str":"166345552051712000","user":{"follow_request_sent":null,"protected":false,"profile_image_url_https":"https:\/\/si0.twimg.com\/sticky\/default_profile_images\/default_profile_4_normal.png","lang":"en","profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_color":"C0DEED","url":null,"name":"Brett Trommer","default_profile_image":true,"contributors_enabled":false,"profile_background_tile":false,"friends_count":751,"utc_offset":null,"favourites_count":0,"profile_sidebar_fill_color":"DDEEF6","description":"infiniti. truly interested in finding fellow tweeters.","id_str":"322113950","is_translator":false,"show_all_inline_media":false,"created_at":"Wed Jun 22 17:13:02 +0000 2011","profile_sidebar_border_color":"C0DEED","following":null,"screen_name":"bretttrommerpan","listed_count":2,"statuses_count":3178,"profile_use_background_image":true,"time_zone":null,"verified":false,"geo_enabled":false,"notifications":null,"profile_text_color":"333333","followers_count":123,"profile_image_url":"http:\/\/a3.twimg.com\/sticky\/default_profile_images\/default_profile_4_normal.png","default_profile":true,"profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme1\/bg.png","id":322113950,"profile_link_color":"0084B4","location":"Omaha, NE"},"created_at":"Mon Feb 06 02:20:44 +0000 2012","favorited":false,"in_reply_to_status_id_str":null,"retweeted":false,"source":"web","id":166345552051712000,"in_reply_to_user_id_str":null,"text":"2012 Infiniti QX56 Review - Auto123 http:\/\/t.co\/MyZ40w9b"}]
--------------------------------------------------------------------------------
/test/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Hello World!
5 | RESTful Android Test Test
6 |
7 |
--------------------------------------------------------------------------------
/test/src/com/jeremyhaberman/restfulandroid/security/test/AuthorizationManagerTest.java:
--------------------------------------------------------------------------------
1 | package com.jeremyhaberman.restfulandroid.security.test;
2 |
3 | import java.net.URI;
4 |
5 | import android.test.AndroidTestCase;
6 |
7 | import com.jeremyhaberman.restfulandroid.rest.Request;
8 | import com.jeremyhaberman.restfulandroid.rest.Response;
9 | import com.jeremyhaberman.restfulandroid.rest.RestClient;
10 | import com.jeremyhaberman.restfulandroid.rest.RestMethodFactory.Method;
11 | import com.jeremyhaberman.restfulandroid.security.AuthorizationManager;
12 | import com.jeremyhaberman.restfulandroid.security.RequestSigner;
13 |
14 | public class AuthorizationManagerTest extends AndroidTestCase {
15 |
16 | /**
17 | * Verifies proper authorization of Requests for Twitter OAuth. This test
18 | * makes a request to the Twitter API to ensure the Authorization header has
19 | * the correct value.
20 | *
21 | * Requires that you have already installed RESTful Android on the
22 | * test device and have logged in.
23 | *
24 | */
25 | public void testAuthorize() {
26 |
27 | URI uri = URI.create("https://api.twitter.com/1/account/verify_credentials.json");
28 | Request request = new Request(Method.GET, uri, null, null);
29 |
30 | RequestSigner signer = AuthorizationManager.getInstance(getContext());
31 | signer.authorize(request);
32 |
33 | RestClient client = new RestClient();
34 | Response response = client.execute(request);
35 | assertTrue(response.status == 200);
36 |
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/test/src/com/jeremyhaberman/restfulandroid/test/TweetTest.java:
--------------------------------------------------------------------------------
1 | package com.jeremyhaberman.restfulandroid.test;
2 | import java.io.BufferedReader;
3 | import java.io.File;
4 | import java.io.FileInputStream;
5 | import java.io.InputStream;
6 | import java.io.InputStreamReader;
7 | import java.io.Reader;
8 | import java.io.StringWriter;
9 | import java.io.Writer;
10 | import java.util.List;
11 |
12 | import junit.framework.Assert;
13 |
14 | import org.json.JSONArray;
15 | import org.json.JSONObject;
16 | import org.json.JSONTokener;
17 |
18 |
19 | import android.test.InstrumentationTestCase;
20 |
21 | import com.jeremyhaberman.restfulandroid.rest.resource.Tweet;
22 | import com.jeremyhaberman.restfulandroid.rest.resource.TwitterTimeline;
23 |
24 |
25 | public class TweetTest extends InstrumentationTestCase{
26 |
27 | JSONObject tweetData;
28 |
29 | @Override
30 | protected void setUp() throws Exception {
31 |
32 | if(tweetData == null){
33 | InputStream is = getInstrumentation().getContext().getResources().openRawResource(R.raw.timeline_response);
34 | Writer writer = new StringWriter();
35 | char[] buffer = new char[1024];
36 | try {
37 | Reader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
38 | int n;
39 | while ((n = reader.read(buffer)) != -1) {
40 | writer.write(buffer, 0, n);
41 | }
42 | } finally {
43 | is.close();
44 | }
45 |
46 | String json = writer.toString();
47 | JSONArray timeline = new JSONArray(json);
48 | tweetData = (JSONObject) timeline.get(0);
49 | }
50 | }
51 |
52 |
53 | public void testGetMessage(){
54 | Tweet tweet = new Tweet(tweetData);
55 | assertEquals("Brady time! Vamos por otro touchdown", tweet.getMessage());
56 | }
57 |
58 | public void testGetAuthorName(){
59 | Tweet tweet = new Tweet(tweetData);
60 | assertEquals("ManuelAcosta10", tweet.getAuthorName());
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/test/src/com/jeremyhaberman/restfulandroid/test/TwitterTimelineTest.java:
--------------------------------------------------------------------------------
1 | package com.jeremyhaberman.restfulandroid.test;
2 | import java.io.BufferedReader;
3 | import java.io.File;
4 | import java.io.FileInputStream;
5 | import java.io.InputStream;
6 | import java.io.InputStreamReader;
7 | import java.io.Reader;
8 | import java.io.StringWriter;
9 | import java.io.Writer;
10 | import java.util.List;
11 |
12 | import junit.framework.Assert;
13 |
14 | import org.json.JSONArray;
15 | import org.json.JSONTokener;
16 |
17 |
18 | import android.test.InstrumentationTestCase;
19 |
20 | import com.jeremyhaberman.restfulandroid.rest.resource.Tweet;
21 | import com.jeremyhaberman.restfulandroid.rest.resource.TwitterTimeline;
22 |
23 |
24 | public class TwitterTimelineTest extends InstrumentationTestCase{
25 |
26 | JSONArray timelineData;
27 |
28 | @Override
29 | protected void setUp() throws Exception {
30 |
31 | if(timelineData == null){
32 | InputStream is = getInstrumentation().getContext().getResources().openRawResource(R.raw.timeline_response);
33 | Writer writer = new StringWriter();
34 | char[] buffer = new char[1024];
35 | try {
36 | Reader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
37 | int n;
38 | while ((n = reader.read(buffer)) != -1) {
39 | writer.write(buffer, 0, n);
40 | }
41 | } finally {
42 | is.close();
43 | }
44 |
45 | String json = writer.toString();
46 |
47 | JSONTokener tokener = new JSONTokener(json);
48 | timelineData = (JSONArray) tokener.nextValue();
49 | }
50 | }
51 |
52 | public void testGetTweetsFromTimeline(){
53 | TwitterTimeline timeline = new TwitterTimeline(timelineData);
54 | List tweets = timeline.getTweets();
55 | Assert.assertNotNull(tweets);
56 | Assert.assertTrue(tweets.size() == 20);
57 |
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------