mirror of
https://github.com/ivacf/archi.git
synced 2026-03-13 09:40:08 +08:00
Migrate to Retrofit stable 2.0.0
This commit is contained in:
@@ -2,12 +2,12 @@ package uk.ivanc.archimvp.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import retrofit.GsonConverterFactory;
|
||||
import retrofit.Retrofit;
|
||||
import retrofit.RxJavaCallAdapterFactory;
|
||||
import retrofit.http.GET;
|
||||
import retrofit.http.Path;
|
||||
import retrofit.http.Url;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Path;
|
||||
import retrofit2.http.Url;
|
||||
import rx.Observable;
|
||||
|
||||
public interface GithubService {
|
||||
|
||||
@@ -4,7 +4,7 @@ import android.util.Log;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import retrofit.HttpException;
|
||||
import retrofit2.adapter.rxjava.HttpException;
|
||||
import rx.Subscriber;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
|
||||
@@ -11,8 +11,9 @@ import org.robolectric.annotation.Config;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import retrofit.HttpException;
|
||||
import retrofit.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.adapter.rxjava.HttpException;
|
||||
import rx.Observable;
|
||||
import rx.schedulers.Schedulers;
|
||||
import uk.ivanc.archimvp.model.GithubService;
|
||||
@@ -90,7 +91,8 @@ public class MainPresenterTest {
|
||||
@Test
|
||||
public void loadRepositoriesCallsShowMessage_withUsernameNotFoundString() {
|
||||
String username = "ivacf";
|
||||
HttpException mockHttpException = new HttpException(Response.error(404, null));
|
||||
HttpException mockHttpException =
|
||||
new HttpException(Response.error(404, mock(ResponseBody.class)));
|
||||
when(githubService.publicRepositories(username))
|
||||
.thenReturn(Observable.<List<Repository>>error(mockHttpException));
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@ package uk.ivanc.archimvvm.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import retrofit.GsonConverterFactory;
|
||||
import retrofit.Retrofit;
|
||||
import retrofit.RxJavaCallAdapterFactory;
|
||||
import retrofit.http.GET;
|
||||
import retrofit.http.Path;
|
||||
import retrofit.http.Url;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Path;
|
||||
import retrofit2.http.Url;
|
||||
import rx.Observable;
|
||||
|
||||
public interface GithubService {
|
||||
|
||||
@@ -13,7 +13,7 @@ import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import retrofit.HttpException;
|
||||
import retrofit2.adapter.rxjava.HttpException;
|
||||
import rx.Subscriber;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
|
||||
@@ -14,8 +14,9 @@ import org.robolectric.annotation.Config;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import retrofit.HttpException;
|
||||
import retrofit.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.adapter.rxjava.HttpException;
|
||||
import rx.Observable;
|
||||
import rx.schedulers.Schedulers;
|
||||
import uk.ivanc.archimvvm.model.GithubService;
|
||||
@@ -74,7 +75,8 @@ public class MainViewModelTest {
|
||||
String username = "invalidUsername";
|
||||
TextView textView = new TextView(application);
|
||||
textView.setText(username);
|
||||
HttpException mockHttpException = new HttpException(Response.error(404, null));
|
||||
HttpException mockHttpException =
|
||||
new HttpException(Response.error(404, mock(ResponseBody.class)));
|
||||
when(githubService.publicRepositories(username))
|
||||
.thenReturn(Observable.<List<Repository>>error(mockHttpException));
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import retrofit.HttpException;
|
||||
import retrofit2.adapter.rxjava.HttpException;
|
||||
import rx.Subscriber;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
|
||||
@@ -2,12 +2,12 @@ package uk.ivanc.archi.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import retrofit.GsonConverterFactory;
|
||||
import retrofit.Retrofit;
|
||||
import retrofit.RxJavaCallAdapterFactory;
|
||||
import retrofit.http.GET;
|
||||
import retrofit.http.Path;
|
||||
import retrofit.http.Url;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Path;
|
||||
import retrofit2.http.Url;
|
||||
import rx.Observable;
|
||||
|
||||
public interface GithubService {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
ext {
|
||||
supportLibraryVersion = '23.3.0'
|
||||
retrofitVersion = '2.0.0-beta2'
|
||||
retrofitVersion = '2.0.0'
|
||||
|
||||
dependencies = [
|
||||
appCompat: "com.android.support:appcompat-v7:$supportLibraryVersion",
|
||||
cardView: "com.android.support:cardview-v7:$supportLibraryVersion",
|
||||
recyclerView: "com.android.support:recyclerview-v7:$supportLibraryVersion",
|
||||
retrofit: "com.squareup.retrofit:retrofit:$retrofitVersion",
|
||||
retrofitConverterGson: "com.squareup.retrofit:converter-gson:$retrofitVersion",
|
||||
retrofitAdapterRxJava: "com.squareup.retrofit:adapter-rxjava:$retrofitVersion",
|
||||
retrofit: "com.squareup.retrofit2:retrofit:$retrofitVersion",
|
||||
retrofitConverterGson: "com.squareup.retrofit2:converter-gson:$retrofitVersion",
|
||||
retrofitAdapterRxJava: "com.squareup.retrofit2:adapter-rxjava:$retrofitVersion",
|
||||
picasso: 'com.squareup.picasso:picasso:2.5.2',
|
||||
rxAndroid: 'io.reactivex:rxandroid:1.1.0',
|
||||
circleImageView: 'de.hdodenhof:circleimageview:1.3.0',
|
||||
|
||||
Reference in New Issue
Block a user