├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── dictionaries │ └── apple.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── MockTest.iml ├── README.md ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── shadev │ │ └── mocktest │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── shadev │ │ │ └── mocktest │ │ │ ├── MainActivity.java │ │ │ ├── model │ │ │ ├── Owner.java │ │ │ └── Repo.java │ │ │ └── rest │ │ │ ├── Github.java │ │ │ ├── GithubFactory.java │ │ │ └── GithubRetrofit.java │ └── res │ │ ├── layout │ │ └── activity_main.xml │ │ ├── menu │ │ └── menu_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── shadev │ └── test │ ├── ApiTest.java │ └── MockitoTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | /captures 8 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | MockTest -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/dictionaries/apple.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | github 5 | repos 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MockTest.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 使用Mockito、Robolectric和RxJava及Retrofit进行单元测试 -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'me.tatarka.retrolambda' 3 | 4 | android { 5 | compileSdkVersion 21 6 | buildToolsVersion "23.0.0" 7 | 8 | defaultConfig { 9 | applicationId "com.shadev.mocktest" 10 | minSdkVersion 15 11 | targetSdkVersion 21 12 | versionCode 1 13 | versionName "1.0" 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | compileOptions { 23 | sourceCompatibility JavaVersion.VERSION_1_8 24 | targetCompatibility JavaVersion.VERSION_1_8 25 | } 26 | } 27 | 28 | dependencies { 29 | compile fileTree(dir: 'libs', include: ['*.jar']) 30 | compile 'com.android.support:appcompat-v7:22.2.0' 31 | 32 | compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0' 33 | compile 'com.squareup.okhttp:okhttp:2.0.0' 34 | compile 'com.squareup.retrofit:retrofit:1.9.0' 35 | 36 | testCompile 'org.assertj:assertj-core:1.7.1' 37 | testCompile 'org.mockito:mockito-core:1.9.5' 38 | testCompile 'junit:junit:4.12' 39 | testCompile 'org.robolectric:shadows-httpclient:3.0' 40 | testCompile ('com.squareup.assertj:assertj-android:1.1.0'){ 41 | exclude module:"support-annotations" 42 | } 43 | testCompile 'org.robolectric:robolectric:3.0' 44 | 45 | compile 'io.reactivex:rxandroid:0.25.0' 46 | } 47 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/apple/tools/android-sdk-macosx/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/shadev/mocktest/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.shadev.mocktest; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/shadev/mocktest/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.shadev.mocktest; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | import android.view.Menu; 6 | import android.view.MenuItem; 7 | 8 | public class MainActivity extends AppCompatActivity { 9 | 10 | @Override protected void onCreate(Bundle savedInstanceState) { 11 | super.onCreate(savedInstanceState); 12 | setContentView(R.layout.activity_main); 13 | } 14 | 15 | @Override public boolean onCreateOptionsMenu(Menu menu) { 16 | // Inflate the menu; this adds items to the action bar if it is present. 17 | getMenuInflater().inflate(R.menu.menu_main, menu); 18 | return true; 19 | } 20 | 21 | @Override public boolean onOptionsItemSelected(MenuItem item) { 22 | // Handle action bar item clicks here. The action bar will 23 | // automatically handle clicks on the Home/Up button, so long 24 | // as you specify a parent activity in AndroidManifest.xml. 25 | int id = item.getItemId(); 26 | 27 | //noinspection SimplifiableIfStatement 28 | if (id == R.id.action_settings) { 29 | return true; 30 | } 31 | 32 | return super.onOptionsItemSelected(item); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/shadev/mocktest/model/Owner.java: -------------------------------------------------------------------------------- 1 | package com.shadev.mocktest.model; 2 | 3 | /** 4 | * Created by devinshine on 15/9/4. 5 | */ 6 | public class Owner { 7 | /** 8 | * login : DevinShine 9 | * id : 7385819 10 | * avatar_url : https://avatars.githubusercontent.com/u/7385819?v=3 11 | * gravatar_id : 12 | * url : https://api.github.com/users/DevinShine 13 | * html_url : https://github.com/DevinShine 14 | * followers_url : https://api.github.com/users/DevinShine/followers 15 | * following_url : https://api.github.com/users/DevinShine/following{/other_user} 16 | * gists_url : https://api.github.com/users/DevinShine/gists{/gist_id} 17 | * starred_url : https://api.github.com/users/DevinShine/starred{/owner}{/repo} 18 | * subscriptions_url : https://api.github.com/users/DevinShine/subscriptions 19 | * organizations_url : https://api.github.com/users/DevinShine/orgs 20 | * repos_url : https://api.github.com/users/DevinShine/repos 21 | * events_url : https://api.github.com/users/DevinShine/events{/privacy} 22 | * received_events_url : https://api.github.com/users/DevinShine/received_events 23 | * type : User 24 | * site_admin : false 25 | */ 26 | 27 | private String login; 28 | private int id; 29 | private String avatar_url; 30 | private String gravatar_id; 31 | private String url; 32 | private String html_url; 33 | private String followers_url; 34 | private String following_url; 35 | private String gists_url; 36 | private String starred_url; 37 | private String subscriptions_url; 38 | private String organizations_url; 39 | private String repos_url; 40 | private String events_url; 41 | private String received_events_url; 42 | private String type; 43 | private boolean site_admin; 44 | 45 | public void setLogin(String login) { 46 | this.login = login; 47 | } 48 | 49 | public void setId(int id) { 50 | this.id = id; 51 | } 52 | 53 | public void setAvatar_url(String avatar_url) { 54 | this.avatar_url = avatar_url; 55 | } 56 | 57 | public void setGravatar_id(String gravatar_id) { 58 | this.gravatar_id = gravatar_id; 59 | } 60 | 61 | public void setUrl(String url) { 62 | this.url = url; 63 | } 64 | 65 | public void setHtml_url(String html_url) { 66 | this.html_url = html_url; 67 | } 68 | 69 | public void setFollowers_url(String followers_url) { 70 | this.followers_url = followers_url; 71 | } 72 | 73 | public void setFollowing_url(String following_url) { 74 | this.following_url = following_url; 75 | } 76 | 77 | public void setGists_url(String gists_url) { 78 | this.gists_url = gists_url; 79 | } 80 | 81 | public void setStarred_url(String starred_url) { 82 | this.starred_url = starred_url; 83 | } 84 | 85 | public void setSubscriptions_url(String subscriptions_url) { 86 | this.subscriptions_url = subscriptions_url; 87 | } 88 | 89 | public void setOrganizations_url(String organizations_url) { 90 | this.organizations_url = organizations_url; 91 | } 92 | 93 | public void setRepos_url(String repos_url) { 94 | this.repos_url = repos_url; 95 | } 96 | 97 | public void setEvents_url(String events_url) { 98 | this.events_url = events_url; 99 | } 100 | 101 | public void setReceived_events_url(String received_events_url) { 102 | this.received_events_url = received_events_url; 103 | } 104 | 105 | public void setType(String type) { 106 | this.type = type; 107 | } 108 | 109 | public void setSite_admin(boolean site_admin) { 110 | this.site_admin = site_admin; 111 | } 112 | 113 | public String getLogin() { 114 | return login; 115 | } 116 | 117 | public int getId() { 118 | return id; 119 | } 120 | 121 | public String getAvatar_url() { 122 | return avatar_url; 123 | } 124 | 125 | public String getGravatar_id() { 126 | return gravatar_id; 127 | } 128 | 129 | public String getUrl() { 130 | return url; 131 | } 132 | 133 | public String getHtml_url() { 134 | return html_url; 135 | } 136 | 137 | public String getFollowers_url() { 138 | return followers_url; 139 | } 140 | 141 | public String getFollowing_url() { 142 | return following_url; 143 | } 144 | 145 | public String getGists_url() { 146 | return gists_url; 147 | } 148 | 149 | public String getStarred_url() { 150 | return starred_url; 151 | } 152 | 153 | public String getSubscriptions_url() { 154 | return subscriptions_url; 155 | } 156 | 157 | public String getOrganizations_url() { 158 | return organizations_url; 159 | } 160 | 161 | public String getRepos_url() { 162 | return repos_url; 163 | } 164 | 165 | public String getEvents_url() { 166 | return events_url; 167 | } 168 | 169 | public String getReceived_events_url() { 170 | return received_events_url; 171 | } 172 | 173 | public String getType() { 174 | return type; 175 | } 176 | 177 | public boolean getSite_admin() { 178 | return site_admin; 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /app/src/main/java/com/shadev/mocktest/model/Repo.java: -------------------------------------------------------------------------------- 1 | package com.shadev.mocktest.model; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * Created by devinshine on 15/9/4. 7 | * 8 | */ 9 | public class Repo { 10 | 11 | /** 12 | * id : 19669199 13 | * name : AnimationDemo 14 | * full_name : DevinShine/AnimationDemo 15 | * owner : {"login":"DevinShine","id":7385819,"avatar_url":"https://avatars.githubusercontent.com/u/7385819?v=3","gravatar_id":"","url":"https://api.github.com/users/DevinShine","html_url":"https://github.com/DevinShine","followers_url":"https://api.github.com/users/DevinShine/followers","following_url":"https://api.github.com/users/DevinShine/following{/other_user}","gists_url":"https://api.github.com/users/DevinShine/gists{/gist_id}","starred_url":"https://api.github.com/users/DevinShine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DevinShine/subscriptions","organizations_url":"https://api.github.com/users/DevinShine/orgs","repos_url":"https://api.github.com/users/DevinShine/repos","events_url":"https://api.github.com/users/DevinShine/events{/privacy}","received_events_url":"https://api.github.com/users/DevinShine/received_events","type":"User","site_admin":false} 16 | * private : false 17 | * html_url : https://github.com/DevinShine/AnimationDemo 18 | * description : 19 | * fork : false 20 | * url : https://api.github.com/repos/DevinShine/AnimationDemo 21 | * forks_url : https://api.github.com/repos/DevinShine/AnimationDemo/forks 22 | * keys_url : https://api.github.com/repos/DevinShine/AnimationDemo/keys{/key_id} 23 | * collaborators_url : https://api.github.com/repos/DevinShine/AnimationDemo/collaborators{/collaborator} 24 | * teams_url : https://api.github.com/repos/DevinShine/AnimationDemo/teams 25 | * hooks_url : https://api.github.com/repos/DevinShine/AnimationDemo/hooks 26 | * issue_events_url : https://api.github.com/repos/DevinShine/AnimationDemo/issues/events{/number} 27 | * events_url : https://api.github.com/repos/DevinShine/AnimationDemo/events 28 | * assignees_url : https://api.github.com/repos/DevinShine/AnimationDemo/assignees{/user} 29 | * branches_url : https://api.github.com/repos/DevinShine/AnimationDemo/branches{/branch} 30 | * tags_url : https://api.github.com/repos/DevinShine/AnimationDemo/tags 31 | * blobs_url : https://api.github.com/repos/DevinShine/AnimationDemo/git/blobs{/sha} 32 | * git_tags_url : https://api.github.com/repos/DevinShine/AnimationDemo/git/tags{/sha} 33 | * git_refs_url : https://api.github.com/repos/DevinShine/AnimationDemo/git/refs{/sha} 34 | * trees_url : https://api.github.com/repos/DevinShine/AnimationDemo/git/trees{/sha} 35 | * statuses_url : https://api.github.com/repos/DevinShine/AnimationDemo/statuses/{sha} 36 | * languages_url : https://api.github.com/repos/DevinShine/AnimationDemo/languages 37 | * stargazers_url : https://api.github.com/repos/DevinShine/AnimationDemo/stargazers 38 | * contributors_url : https://api.github.com/repos/DevinShine/AnimationDemo/contributors 39 | * subscribers_url : https://api.github.com/repos/DevinShine/AnimationDemo/subscribers 40 | * subscription_url : https://api.github.com/repos/DevinShine/AnimationDemo/subscription 41 | * commits_url : https://api.github.com/repos/DevinShine/AnimationDemo/commits{/sha} 42 | * git_commits_url : https://api.github.com/repos/DevinShine/AnimationDemo/git/commits{/sha} 43 | * comments_url : https://api.github.com/repos/DevinShine/AnimationDemo/comments{/number} 44 | * issue_comment_url : https://api.github.com/repos/DevinShine/AnimationDemo/issues/comments{/number} 45 | * contents_url : https://api.github.com/repos/DevinShine/AnimationDemo/contents/{+path} 46 | * compare_url : https://api.github.com/repos/DevinShine/AnimationDemo/compare/{base}...{head} 47 | * merges_url : https://api.github.com/repos/DevinShine/AnimationDemo/merges 48 | * archive_url : https://api.github.com/repos/DevinShine/AnimationDemo/{archive_format}{/ref} 49 | * downloads_url : https://api.github.com/repos/DevinShine/AnimationDemo/downloads 50 | * issues_url : https://api.github.com/repos/DevinShine/AnimationDemo/issues{/number} 51 | * pulls_url : https://api.github.com/repos/DevinShine/AnimationDemo/pulls{/number} 52 | * milestones_url : https://api.github.com/repos/DevinShine/AnimationDemo/milestones{/number} 53 | * notifications_url : https://api.github.com/repos/DevinShine/AnimationDemo/notifications{?since,all,participating} 54 | * labels_url : https://api.github.com/repos/DevinShine/AnimationDemo/labels{/name} 55 | * releases_url : https://api.github.com/repos/DevinShine/AnimationDemo/releases{/id} 56 | * created_at : 2014-05-11T15:05:26Z 57 | * updated_at : 2014-05-11T15:16:59Z 58 | * pushed_at : 2014-05-11T15:16:58Z 59 | * git_url : git://github.com/DevinShine/AnimationDemo.git 60 | * ssh_url : git@github.com:DevinShine/AnimationDemo.git 61 | * clone_url : https://github.com/DevinShine/AnimationDemo.git 62 | * svn_url : https://github.com/DevinShine/AnimationDemo 63 | * homepage : null 64 | * size : 1556 65 | * stargazers_count : 0 66 | * watchers_count : 0 67 | * language : Java 68 | * has_issues : true 69 | * has_downloads : true 70 | * has_wiki : true 71 | * has_pages : false 72 | * forks_count : 0 73 | * mirror_url : null 74 | * open_issues_count : 0 75 | * forks : 0 76 | * open_issues : 0 77 | * watchers : 0 78 | * default_branch : master 79 | */ 80 | 81 | private int id; 82 | private String name; 83 | private String full_name; 84 | private Owner owner; 85 | @SerializedName("private") private boolean privateX; 86 | private String html_url; 87 | private String description; 88 | private boolean fork; 89 | private String url; 90 | private String forks_url; 91 | private String keys_url; 92 | private String collaborators_url; 93 | private String teams_url; 94 | private String hooks_url; 95 | private String issue_events_url; 96 | private String events_url; 97 | private String assignees_url; 98 | private String branches_url; 99 | private String tags_url; 100 | private String blobs_url; 101 | private String git_tags_url; 102 | private String git_refs_url; 103 | private String trees_url; 104 | private String statuses_url; 105 | private String languages_url; 106 | private String stargazers_url; 107 | private String contributors_url; 108 | private String subscribers_url; 109 | private String subscription_url; 110 | private String commits_url; 111 | private String git_commits_url; 112 | private String comments_url; 113 | private String issue_comment_url; 114 | private String contents_url; 115 | private String compare_url; 116 | private String merges_url; 117 | private String archive_url; 118 | private String downloads_url; 119 | private String issues_url; 120 | private String pulls_url; 121 | private String milestones_url; 122 | private String notifications_url; 123 | private String labels_url; 124 | private String releases_url; 125 | private String created_at; 126 | private String updated_at; 127 | private String pushed_at; 128 | private String git_url; 129 | private String ssh_url; 130 | private String clone_url; 131 | private String svn_url; 132 | private Object homepage; 133 | private int size; 134 | private int stargazers_count; 135 | private int watchers_count; 136 | private String language; 137 | private boolean has_issues; 138 | private boolean has_downloads; 139 | private boolean has_wiki; 140 | private boolean has_pages; 141 | private int forks_count; 142 | private Object mirror_url; 143 | private int open_issues_count; 144 | private int forks; 145 | private int open_issues; 146 | private int watchers; 147 | private String default_branch; 148 | 149 | public void setId(int id) { 150 | this.id = id; 151 | } 152 | 153 | public void setName(String name) { 154 | this.name = name; 155 | } 156 | 157 | public void setFull_name(String full_name) { 158 | this.full_name = full_name; 159 | } 160 | 161 | public void setOwner(Owner owner) { 162 | this.owner = owner; 163 | } 164 | 165 | public void setPrivateX(boolean privateX) { 166 | this.privateX = privateX; 167 | } 168 | 169 | public void setHtml_url(String html_url) { 170 | this.html_url = html_url; 171 | } 172 | 173 | public void setDescription(String description) { 174 | this.description = description; 175 | } 176 | 177 | public void setFork(boolean fork) { 178 | this.fork = fork; 179 | } 180 | 181 | public void setUrl(String url) { 182 | this.url = url; 183 | } 184 | 185 | public void setForks_url(String forks_url) { 186 | this.forks_url = forks_url; 187 | } 188 | 189 | public void setKeys_url(String keys_url) { 190 | this.keys_url = keys_url; 191 | } 192 | 193 | public void setCollaborators_url(String collaborators_url) { 194 | this.collaborators_url = collaborators_url; 195 | } 196 | 197 | public void setTeams_url(String teams_url) { 198 | this.teams_url = teams_url; 199 | } 200 | 201 | public void setHooks_url(String hooks_url) { 202 | this.hooks_url = hooks_url; 203 | } 204 | 205 | public void setIssue_events_url(String issue_events_url) { 206 | this.issue_events_url = issue_events_url; 207 | } 208 | 209 | public void setEvents_url(String events_url) { 210 | this.events_url = events_url; 211 | } 212 | 213 | public void setAssignees_url(String assignees_url) { 214 | this.assignees_url = assignees_url; 215 | } 216 | 217 | public void setBranches_url(String branches_url) { 218 | this.branches_url = branches_url; 219 | } 220 | 221 | public void setTags_url(String tags_url) { 222 | this.tags_url = tags_url; 223 | } 224 | 225 | public void setBlobs_url(String blobs_url) { 226 | this.blobs_url = blobs_url; 227 | } 228 | 229 | public void setGit_tags_url(String git_tags_url) { 230 | this.git_tags_url = git_tags_url; 231 | } 232 | 233 | public void setGit_refs_url(String git_refs_url) { 234 | this.git_refs_url = git_refs_url; 235 | } 236 | 237 | public void setTrees_url(String trees_url) { 238 | this.trees_url = trees_url; 239 | } 240 | 241 | public void setStatuses_url(String statuses_url) { 242 | this.statuses_url = statuses_url; 243 | } 244 | 245 | public void setLanguages_url(String languages_url) { 246 | this.languages_url = languages_url; 247 | } 248 | 249 | public void setStargazers_url(String stargazers_url) { 250 | this.stargazers_url = stargazers_url; 251 | } 252 | 253 | public void setContributors_url(String contributors_url) { 254 | this.contributors_url = contributors_url; 255 | } 256 | 257 | public void setSubscribers_url(String subscribers_url) { 258 | this.subscribers_url = subscribers_url; 259 | } 260 | 261 | public void setSubscription_url(String subscription_url) { 262 | this.subscription_url = subscription_url; 263 | } 264 | 265 | public void setCommits_url(String commits_url) { 266 | this.commits_url = commits_url; 267 | } 268 | 269 | public void setGit_commits_url(String git_commits_url) { 270 | this.git_commits_url = git_commits_url; 271 | } 272 | 273 | public void setComments_url(String comments_url) { 274 | this.comments_url = comments_url; 275 | } 276 | 277 | public void setIssue_comment_url(String issue_comment_url) { 278 | this.issue_comment_url = issue_comment_url; 279 | } 280 | 281 | public void setContents_url(String contents_url) { 282 | this.contents_url = contents_url; 283 | } 284 | 285 | public void setCompare_url(String compare_url) { 286 | this.compare_url = compare_url; 287 | } 288 | 289 | public void setMerges_url(String merges_url) { 290 | this.merges_url = merges_url; 291 | } 292 | 293 | public void setArchive_url(String archive_url) { 294 | this.archive_url = archive_url; 295 | } 296 | 297 | public void setDownloads_url(String downloads_url) { 298 | this.downloads_url = downloads_url; 299 | } 300 | 301 | public void setIssues_url(String issues_url) { 302 | this.issues_url = issues_url; 303 | } 304 | 305 | public void setPulls_url(String pulls_url) { 306 | this.pulls_url = pulls_url; 307 | } 308 | 309 | public void setMilestones_url(String milestones_url) { 310 | this.milestones_url = milestones_url; 311 | } 312 | 313 | public void setNotifications_url(String notifications_url) { 314 | this.notifications_url = notifications_url; 315 | } 316 | 317 | public void setLabels_url(String labels_url) { 318 | this.labels_url = labels_url; 319 | } 320 | 321 | public void setReleases_url(String releases_url) { 322 | this.releases_url = releases_url; 323 | } 324 | 325 | public void setCreated_at(String created_at) { 326 | this.created_at = created_at; 327 | } 328 | 329 | public void setUpdated_at(String updated_at) { 330 | this.updated_at = updated_at; 331 | } 332 | 333 | public void setPushed_at(String pushed_at) { 334 | this.pushed_at = pushed_at; 335 | } 336 | 337 | public void setGit_url(String git_url) { 338 | this.git_url = git_url; 339 | } 340 | 341 | public void setSsh_url(String ssh_url) { 342 | this.ssh_url = ssh_url; 343 | } 344 | 345 | public void setClone_url(String clone_url) { 346 | this.clone_url = clone_url; 347 | } 348 | 349 | public void setSvn_url(String svn_url) { 350 | this.svn_url = svn_url; 351 | } 352 | 353 | public void setHomepage(Object homepage) { 354 | this.homepage = homepage; 355 | } 356 | 357 | public void setSize(int size) { 358 | this.size = size; 359 | } 360 | 361 | public void setStargazers_count(int stargazers_count) { 362 | this.stargazers_count = stargazers_count; 363 | } 364 | 365 | public void setWatchers_count(int watchers_count) { 366 | this.watchers_count = watchers_count; 367 | } 368 | 369 | public void setLanguage(String language) { 370 | this.language = language; 371 | } 372 | 373 | public void setHas_issues(boolean has_issues) { 374 | this.has_issues = has_issues; 375 | } 376 | 377 | public void setHas_downloads(boolean has_downloads) { 378 | this.has_downloads = has_downloads; 379 | } 380 | 381 | public void setHas_wiki(boolean has_wiki) { 382 | this.has_wiki = has_wiki; 383 | } 384 | 385 | public void setHas_pages(boolean has_pages) { 386 | this.has_pages = has_pages; 387 | } 388 | 389 | public void setForks_count(int forks_count) { 390 | this.forks_count = forks_count; 391 | } 392 | 393 | public void setMirror_url(Object mirror_url) { 394 | this.mirror_url = mirror_url; 395 | } 396 | 397 | public void setOpen_issues_count(int open_issues_count) { 398 | this.open_issues_count = open_issues_count; 399 | } 400 | 401 | public void setForks(int forks) { 402 | this.forks = forks; 403 | } 404 | 405 | public void setOpen_issues(int open_issues) { 406 | this.open_issues = open_issues; 407 | } 408 | 409 | public void setWatchers(int watchers) { 410 | this.watchers = watchers; 411 | } 412 | 413 | public void setDefault_branch(String default_branch) { 414 | this.default_branch = default_branch; 415 | } 416 | 417 | public int getId() { 418 | return id; 419 | } 420 | 421 | public String getName() { 422 | return name; 423 | } 424 | 425 | public String getFull_name() { 426 | return full_name; 427 | } 428 | 429 | public Owner getOwner() { 430 | return owner; 431 | } 432 | 433 | public boolean getPrivateX() { 434 | return privateX; 435 | } 436 | 437 | public String getHtml_url() { 438 | return html_url; 439 | } 440 | 441 | public String getDescription() { 442 | return description; 443 | } 444 | 445 | public boolean getFork() { 446 | return fork; 447 | } 448 | 449 | public String getUrl() { 450 | return url; 451 | } 452 | 453 | public String getForks_url() { 454 | return forks_url; 455 | } 456 | 457 | public String getKeys_url() { 458 | return keys_url; 459 | } 460 | 461 | public String getCollaborators_url() { 462 | return collaborators_url; 463 | } 464 | 465 | public String getTeams_url() { 466 | return teams_url; 467 | } 468 | 469 | public String getHooks_url() { 470 | return hooks_url; 471 | } 472 | 473 | public String getIssue_events_url() { 474 | return issue_events_url; 475 | } 476 | 477 | public String getEvents_url() { 478 | return events_url; 479 | } 480 | 481 | public String getAssignees_url() { 482 | return assignees_url; 483 | } 484 | 485 | public String getBranches_url() { 486 | return branches_url; 487 | } 488 | 489 | public String getTags_url() { 490 | return tags_url; 491 | } 492 | 493 | public String getBlobs_url() { 494 | return blobs_url; 495 | } 496 | 497 | public String getGit_tags_url() { 498 | return git_tags_url; 499 | } 500 | 501 | public String getGit_refs_url() { 502 | return git_refs_url; 503 | } 504 | 505 | public String getTrees_url() { 506 | return trees_url; 507 | } 508 | 509 | public String getStatuses_url() { 510 | return statuses_url; 511 | } 512 | 513 | public String getLanguages_url() { 514 | return languages_url; 515 | } 516 | 517 | public String getStargazers_url() { 518 | return stargazers_url; 519 | } 520 | 521 | public String getContributors_url() { 522 | return contributors_url; 523 | } 524 | 525 | public String getSubscribers_url() { 526 | return subscribers_url; 527 | } 528 | 529 | public String getSubscription_url() { 530 | return subscription_url; 531 | } 532 | 533 | public String getCommits_url() { 534 | return commits_url; 535 | } 536 | 537 | public String getGit_commits_url() { 538 | return git_commits_url; 539 | } 540 | 541 | public String getComments_url() { 542 | return comments_url; 543 | } 544 | 545 | public String getIssue_comment_url() { 546 | return issue_comment_url; 547 | } 548 | 549 | public String getContents_url() { 550 | return contents_url; 551 | } 552 | 553 | public String getCompare_url() { 554 | return compare_url; 555 | } 556 | 557 | public String getMerges_url() { 558 | return merges_url; 559 | } 560 | 561 | public String getArchive_url() { 562 | return archive_url; 563 | } 564 | 565 | public String getDownloads_url() { 566 | return downloads_url; 567 | } 568 | 569 | public String getIssues_url() { 570 | return issues_url; 571 | } 572 | 573 | public String getPulls_url() { 574 | return pulls_url; 575 | } 576 | 577 | public String getMilestones_url() { 578 | return milestones_url; 579 | } 580 | 581 | public String getNotifications_url() { 582 | return notifications_url; 583 | } 584 | 585 | public String getLabels_url() { 586 | return labels_url; 587 | } 588 | 589 | public String getReleases_url() { 590 | return releases_url; 591 | } 592 | 593 | public String getCreated_at() { 594 | return created_at; 595 | } 596 | 597 | public String getUpdated_at() { 598 | return updated_at; 599 | } 600 | 601 | public String getPushed_at() { 602 | return pushed_at; 603 | } 604 | 605 | public String getGit_url() { 606 | return git_url; 607 | } 608 | 609 | public String getSsh_url() { 610 | return ssh_url; 611 | } 612 | 613 | public String getClone_url() { 614 | return clone_url; 615 | } 616 | 617 | public String getSvn_url() { 618 | return svn_url; 619 | } 620 | 621 | public Object getHomepage() { 622 | return homepage; 623 | } 624 | 625 | public int getSize() { 626 | return size; 627 | } 628 | 629 | public int getStargazers_count() { 630 | return stargazers_count; 631 | } 632 | 633 | public int getWatchers_count() { 634 | return watchers_count; 635 | } 636 | 637 | public String getLanguage() { 638 | return language; 639 | } 640 | 641 | public boolean getHas_issues() { 642 | return has_issues; 643 | } 644 | 645 | public boolean getHas_downloads() { 646 | return has_downloads; 647 | } 648 | 649 | public boolean getHas_wiki() { 650 | return has_wiki; 651 | } 652 | 653 | public boolean getHas_pages() { 654 | return has_pages; 655 | } 656 | 657 | public int getForks_count() { 658 | return forks_count; 659 | } 660 | 661 | public Object getMirror_url() { 662 | return mirror_url; 663 | } 664 | 665 | public int getOpen_issues_count() { 666 | return open_issues_count; 667 | } 668 | 669 | public int getForks() { 670 | return forks; 671 | } 672 | 673 | public int getOpen_issues() { 674 | return open_issues; 675 | } 676 | 677 | public int getWatchers() { 678 | return watchers; 679 | } 680 | 681 | public String getDefault_branch() { 682 | return default_branch; 683 | } 684 | 685 | } 686 | -------------------------------------------------------------------------------- /app/src/main/java/com/shadev/mocktest/rest/Github.java: -------------------------------------------------------------------------------- 1 | package com.shadev.mocktest.rest; 2 | 3 | import com.shadev.mocktest.model.Repo; 4 | import java.util.List; 5 | import retrofit.http.GET; 6 | import retrofit.http.Path; 7 | import rx.Observable; 8 | 9 | /** 10 | * Created by devinshine on 15/9/4. 11 | * github api 12 | */ 13 | public interface Github { 14 | 15 | @GET("/users/{user}/repos") 16 | public List listRepos(@Path("user") String user); 17 | 18 | @GET("/users/{user}/repos") 19 | public Observable> listRepos2Observable(@Path("user") String user); 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/shadev/mocktest/rest/GithubFactory.java: -------------------------------------------------------------------------------- 1 | package com.shadev.mocktest.rest; 2 | 3 | /** 4 | * Created by devinshine on 15/9/4. 5 | * 6 | */ 7 | public class GithubFactory { 8 | protected static final Object monitor = new Object(); 9 | static Github sSingleton = null; 10 | 11 | public static Github getSingleton() { 12 | synchronized (monitor) { 13 | if (sSingleton == null) { 14 | sSingleton = new GithubRetrofit().getService(); 15 | } 16 | return sSingleton; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/shadev/mocktest/rest/GithubRetrofit.java: -------------------------------------------------------------------------------- 1 | package com.shadev.mocktest.rest; 2 | 3 | import com.google.gson.Gson; 4 | import com.google.gson.GsonBuilder; 5 | import com.squareup.okhttp.OkHttpClient; 6 | import java.util.concurrent.TimeUnit; 7 | import retrofit.RequestInterceptor; 8 | import retrofit.RestAdapter; 9 | import retrofit.client.OkClient; 10 | import retrofit.converter.GsonConverter; 11 | 12 | /** 13 | * Created by devinshine on 15/9/4. 14 | * retrofit 实例 15 | */ 16 | public class GithubRetrofit { 17 | final Github service; 18 | 19 | final static Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") 20 | .serializeNulls() 21 | .create(); 22 | 23 | RequestInterceptor requestInterceptor = request -> request.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0"); 24 | 25 | GithubRetrofit() { 26 | OkHttpClient client = new OkHttpClient(); 27 | client.setReadTimeout(12, TimeUnit.SECONDS); 28 | 29 | RestAdapter restAdapter = new RestAdapter.Builder().setClient(new OkClient(client)) 30 | .setLogLevel(RestAdapter.LogLevel.FULL) 31 | .setEndpoint("https://api.github.com") 32 | .setConverter(new GsonConverter(gson)) 33 | .setRequestInterceptor(requestInterceptor) 34 | .build(); 35 | service = restAdapter.create(Github.class); 36 | } 37 | 38 | public Github getService() { 39 | return service; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevinShine/MockTest/b681555bc582135e2c935391b8f81d154c3888a9/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevinShine/MockTest/b681555bc582135e2c935391b8f81d154c3888a9/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevinShine/MockTest/b681555bc582135e2c935391b8f81d154c3888a9/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevinShine/MockTest/b681555bc582135e2c935391b8f81d154c3888a9/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | MockTest 3 | 4 | Hello world! 5 | Settings 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/test/java/com/shadev/test/ApiTest.java: -------------------------------------------------------------------------------- 1 | package com.shadev.test; 2 | 3 | import com.google.gson.Gson; 4 | import com.google.gson.GsonBuilder; 5 | import com.shadev.mocktest.BuildConfig; 6 | import com.shadev.mocktest.model.Repo; 7 | import com.shadev.mocktest.rest.Github; 8 | import com.shadev.mocktest.rest.GithubFactory; 9 | import com.squareup.okhttp.OkHttpClient; 10 | import java.io.IOException; 11 | import java.util.Collections; 12 | import java.util.List; 13 | import org.apache.http.HttpResponse; 14 | import org.apache.http.client.methods.HttpGet; 15 | import org.apache.http.impl.client.DefaultHttpClient; 16 | import org.apache.http.util.EntityUtils; 17 | import org.junit.Before; 18 | import org.junit.Test; 19 | import org.junit.runner.RunWith; 20 | import org.mockito.Matchers; 21 | import org.robolectric.RobolectricGradleTestRunner; 22 | import org.robolectric.annotation.Config; 23 | import org.robolectric.shadows.httpclient.FakeHttp; 24 | import retrofit.RequestInterceptor; 25 | import retrofit.RestAdapter; 26 | import retrofit.client.Client; 27 | import retrofit.client.Response; 28 | import retrofit.converter.GsonConverter; 29 | import retrofit.mime.TypedByteArray; 30 | import rx.Observable; 31 | 32 | /** 33 | * Created by devinshine on 15/9/4. 34 | * 35 | */ 36 | import static org.hamcrest.MatcherAssert.assertThat; 37 | import static org.hamcrest.core.Is.is; 38 | import static org.hamcrest.core.IsNot.not; 39 | import static org.mockito.Mockito.mock; 40 | import static org.mockito.Mockito.when; 41 | 42 | @RunWith(RobolectricGradleTestRunner.class) @Config(constants = BuildConfig.class) 43 | public class ApiTest { 44 | 45 | Github mGithub = GithubFactory.getSingleton();//走真实数据的接口 46 | 47 | Github mMockGithub; 48 | Client mMockClient; 49 | 50 | @Before public void setUp() { 51 | Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") 52 | .serializeNulls() 53 | .create(); 54 | mMockClient = mock(Client.class); 55 | RequestInterceptor requestInterceptor = request -> request.addHeader("User-Agent", 56 | "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0"); 57 | RestAdapter restAdapter = new RestAdapter.Builder().setClient(mMockClient) 58 | .setLogLevel(RestAdapter.LogLevel.FULL) 59 | .setEndpoint("https://api.github.com") 60 | .setConverter(new GsonConverter(gson)) 61 | .setRequestInterceptor(requestInterceptor) 62 | .build(); 63 | mMockGithub = restAdapter.create(Github.class); 64 | } 65 | 66 | //Test1 67 | @Test public void reposTest1() throws IOException { 68 | String mockJsonResult = 69 | "[{\"id\":19669199,\"name\":\"AnimationDemo\",\"full_name\":\"DevinShine/AnimationDemo\",\"owner\":{\"login\":\"DevinShine\",\"id\":7385819,\"avatar_url\":\"https://avatars.githubusercontent.com/u/7385819?v=3\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/DevinShine\",\"html_url\":\"https://github.com/DevinShine\",\"followers_url\":\"https://api.github.com/users/DevinShine/followers\",\"following_url\":\"https://api.github.com/users/DevinShine/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/DevinShine/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/DevinShine/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/DevinShine/subscriptions\",\"organizations_url\":\"https://api.github.com/users/DevinShine/orgs\",\"repos_url\":\"https://api.github.com/users/DevinShine/repos\",\"events_url\":\"https://api.github.com/users/DevinShine/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/DevinShine/received_events\",\"type\":\"User\",\"site_admin\":false},\"private\":false,\"html_url\":\"https://github.com/DevinShine/AnimationDemo\",\"description\":\"\",\"fork\":false,\"url\":\"https://api.github.com/repos/DevinShine/AnimationDemo\",\"forks_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/forks\",\"keys_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/keys{/key_id}\",\"collaborators_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/collaborators{/collaborator}\",\"teams_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/teams\",\"hooks_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/hooks\",\"issue_events_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/issues/events{/number}\",\"events_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/events\",\"assignees_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/assignees{/user}\",\"branches_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/branches{/branch}\",\"tags_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/tags\",\"blobs_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/git/blobs{/sha}\",\"git_tags_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/git/tags{/sha}\",\"git_refs_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/git/refs{/sha}\",\"trees_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/git/trees{/sha}\",\"statuses_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/statuses/{sha}\",\"languages_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/languages\",\"stargazers_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/stargazers\",\"contributors_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/contributors\",\"subscribers_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/subscribers\",\"subscription_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/subscription\",\"commits_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/commits{/sha}\",\"git_commits_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/git/commits{/sha}\",\"comments_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/comments{/number}\",\"issue_comment_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/issues/comments{/number}\",\"contents_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/contents/{+path}\",\"compare_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/compare/{base}...{head}\",\"merges_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/merges\",\"archive_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/{archive_format}{/ref}\",\"downloads_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/downloads\",\"issues_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/issues{/number}\",\"pulls_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/pulls{/number}\",\"milestones_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/milestones{/number}\",\"notifications_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/notifications{?since,all,participating}\",\"labels_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/labels{/name}\",\"releases_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/releases{/id}\",\"created_at\":\"2014-05-11T15:05:26Z\",\"updated_at\":\"2014-05-11T15:16:59Z\",\"pushed_at\":\"2014-05-11T15:16:58Z\",\"git_url\":\"git://github.com/DevinShine/AnimationDemo.git\",\"ssh_url\":\"git@github.com:DevinShine/AnimationDemo.git\",\"clone_url\":\"https://github.com/DevinShine/AnimationDemo.git\",\"svn_url\":\"https://github.com/DevinShine/AnimationDemo\",\"homepage\":null,\"size\":1556,\"stargazers_count\":0,\"watchers_count\":0,\"language\":\"Java\",\"has_issues\":true,\"has_downloads\":true,\"has_wiki\":true,\"has_pages\":false,\"forks_count\":0,\"mirror_url\":null,\"open_issues_count\":0,\"forks\":0,\"open_issues\":0,\"watchers\":0,\"default_branch\":\"master\"}]"; 70 | FakeHttp.addPendingHttpResponse(200, mockJsonResult); 71 | 72 | HttpGet httpGet = new HttpGet("http://www.baidu.com"); 73 | HttpResponse httpResponse = new DefaultHttpClient().execute(httpGet); 74 | String result = EntityUtils.toString(httpResponse.getEntity()); 75 | System.out.print(result); 76 | assertThat(result, is(mockJsonResult)); 77 | } 78 | 79 | //Test2 这个是走真实网络返回的数据 80 | @Test public void reposTest2() { 81 | List list = mGithub.listRepos("devinshine"); 82 | assertThat(list.size(), is(not(0))); 83 | System.out.print(list.size()); 84 | } 85 | 86 | //Test3 这个是走真实网络返回的数据 87 | @Test public void reposTestByObservable() { 88 | int size = mGithub.listRepos2Observable("devinshine") 89 | .flatMap(Observable::from) 90 | .count() 91 | .toBlocking() 92 | .single(); 93 | assertThat(size, is(not(0))); 94 | System.out.print(size); 95 | 96 | //下面代码是会报错的 97 | //TestSubscriber testSubscriber = new TestSubscriber<>(); 98 | //mGithub.listRepos2Observable("devinshine") 99 | // .flatMap(Observable::from) 100 | // .subscribe(testSubscriber); 101 | //assertThat(testSubscriber.getOnNextEvents().size(),is(not(0))); 102 | } 103 | 104 | //Test4 这是走模拟数据 105 | @Test public void reposTestByMockClient() throws IOException { 106 | String mockJsonResult = 107 | "[{\"id\":19669199,\"name\":\"AnimationDemo\",\"full_name\":\"DevinShine/AnimationDemo\",\"owner\":{\"login\":\"DevinShine\",\"id\":7385819,\"avatar_url\":\"https://avatars.githubusercontent.com/u/7385819?v=3\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/DevinShine\",\"html_url\":\"https://github.com/DevinShine\",\"followers_url\":\"https://api.github.com/users/DevinShine/followers\",\"following_url\":\"https://api.github.com/users/DevinShine/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/DevinShine/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/DevinShine/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/DevinShine/subscriptions\",\"organizations_url\":\"https://api.github.com/users/DevinShine/orgs\",\"repos_url\":\"https://api.github.com/users/DevinShine/repos\",\"events_url\":\"https://api.github.com/users/DevinShine/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/DevinShine/received_events\",\"type\":\"User\",\"site_admin\":false},\"private\":false,\"html_url\":\"https://github.com/DevinShine/AnimationDemo\",\"description\":\"\",\"fork\":false,\"url\":\"https://api.github.com/repos/DevinShine/AnimationDemo\",\"forks_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/forks\",\"keys_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/keys{/key_id}\",\"collaborators_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/collaborators{/collaborator}\",\"teams_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/teams\",\"hooks_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/hooks\",\"issue_events_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/issues/events{/number}\",\"events_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/events\",\"assignees_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/assignees{/user}\",\"branches_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/branches{/branch}\",\"tags_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/tags\",\"blobs_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/git/blobs{/sha}\",\"git_tags_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/git/tags{/sha}\",\"git_refs_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/git/refs{/sha}\",\"trees_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/git/trees{/sha}\",\"statuses_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/statuses/{sha}\",\"languages_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/languages\",\"stargazers_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/stargazers\",\"contributors_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/contributors\",\"subscribers_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/subscribers\",\"subscription_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/subscription\",\"commits_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/commits{/sha}\",\"git_commits_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/git/commits{/sha}\",\"comments_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/comments{/number}\",\"issue_comment_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/issues/comments{/number}\",\"contents_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/contents/{+path}\",\"compare_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/compare/{base}...{head}\",\"merges_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/merges\",\"archive_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/{archive_format}{/ref}\",\"downloads_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/downloads\",\"issues_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/issues{/number}\",\"pulls_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/pulls{/number}\",\"milestones_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/milestones{/number}\",\"notifications_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/notifications{?since,all,participating}\",\"labels_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/labels{/name}\",\"releases_url\":\"https://api.github.com/repos/DevinShine/AnimationDemo/releases{/id}\",\"created_at\":\"2014-05-11T15:05:26Z\",\"updated_at\":\"2014-05-11T15:16:59Z\",\"pushed_at\":\"2014-05-11T15:16:58Z\",\"git_url\":\"git://github.com/DevinShine/AnimationDemo.git\",\"ssh_url\":\"git@github.com:DevinShine/AnimationDemo.git\",\"clone_url\":\"https://github.com/DevinShine/AnimationDemo.git\",\"svn_url\":\"https://github.com/DevinShine/AnimationDemo\",\"homepage\":null,\"size\":1556,\"stargazers_count\":0,\"watchers_count\":0,\"language\":\"Java\",\"has_issues\":true,\"has_downloads\":true,\"has_wiki\":true,\"has_pages\":false,\"forks_count\":0,\"mirror_url\":null,\"open_issues_count\":0,\"forks\":0,\"open_issues\":0,\"watchers\":0,\"default_branch\":\"master\"}]"; 108 | Response response = 109 | new Response("http://www.baidu.com", 200, "nothing", Collections.EMPTY_LIST, 110 | new TypedByteArray("application/json", mockJsonResult.getBytes())); 111 | when(mMockClient.execute(Matchers.anyObject())).thenReturn(response); 112 | 113 | int size = mMockGithub.listRepos2Observable("devinshine") 114 | .flatMap(Observable::from) 115 | .count() 116 | .toBlocking() 117 | .single(); 118 | assertThat(size, is(1)); 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /app/src/test/java/com/shadev/test/MockitoTest.java: -------------------------------------------------------------------------------- 1 | package com.shadev.test; 2 | 3 | /** 4 | * Created by devinshine on 15/9/4. 5 | * 6 | */ 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.junit.Before; 10 | import org.junit.Test; 11 | import rx.Observable; 12 | import rx.observers.TestSubscriber; 13 | 14 | import static org.hamcrest.MatcherAssert.assertThat; 15 | import static org.hamcrest.core.Is.is; 16 | public class MockitoTest { 17 | 18 | 19 | @Before 20 | public void setUp(){ 21 | 22 | } 23 | 24 | @Test 25 | public void MocksTest(){ 26 | TestSubscriber testSubscriber = new TestSubscriber<>(); 27 | getMocks().subscribe(testSubscriber); 28 | assertThat(testSubscriber.getOnNextEvents().size(),is(3)); 29 | } 30 | 31 | @Test 32 | public void ListMocksTest(){ 33 | TestSubscriber testSubscriber = new TestSubscriber<>(); 34 | getListMocks().flatMap(Observable::from).subscribe(testSubscriber); 35 | assertThat(testSubscriber.getOnNextEvents().size(), is(3)); 36 | } 37 | 38 | 39 | private Observable getMocks(){ 40 | return Observable.just(new Mock(),new Mock(),new Mock()); 41 | } 42 | 43 | private Observable> getListMocks(){ 44 | List list = new ArrayList<>(); 45 | list.add(new Mock()); 46 | list.add(new Mock()); 47 | list.add(new Mock()); 48 | return Observable.just(list); 49 | } 50 | 51 | class Mock{ 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.2.3' 9 | classpath 'me.tatarka:gradle-retrolambda:3.2.2' 10 | 11 | // NOTE: Do not place your application dependencies here; they belong 12 | // in the individual module build.gradle files 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | jcenter() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevinShine/MockTest/b681555bc582135e2c935391b8f81d154c3888a9/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Sep 04 22:20:49 CST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------