Search in sources :

Example 31 with Retrofit

use of retrofit2.Retrofit in project retrofit by square.

the class AsyncTest method setUp.

@Before
public void setUp() {
    Retrofit retrofit = new Retrofit.Builder().baseUrl(server.url("/")).addCallAdapterFactory(RxJava2CallAdapterFactory.createAsync()).build();
    service = retrofit.create(Service.class);
}
Also used : Retrofit(retrofit2.Retrofit) Before(org.junit.Before)

Example 32 with Retrofit

use of retrofit2.Retrofit in project retrofit by square.

the class ObservableTest method setUp.

@Before
public void setUp() {
    Retrofit retrofit = new Retrofit.Builder().baseUrl(server.url("/")).addConverterFactory(new StringConverterFactory()).addCallAdapterFactory(RxJavaCallAdapterFactory.create()).build();
    service = retrofit.create(Service.class);
}
Also used : Retrofit(retrofit2.Retrofit) Before(org.junit.Before)

Example 33 with Retrofit

use of retrofit2.Retrofit in project retrofit by square.

the class CompletableTest method setUp.

@Before
public void setUp() {
    Retrofit retrofit = new Retrofit.Builder().baseUrl(server.url("/")).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).build();
    service = retrofit.create(Service.class);
}
Also used : Retrofit(retrofit2.Retrofit) Before(org.junit.Before)

Example 34 with Retrofit

use of retrofit2.Retrofit in project retrofit by square.

the class CompletableWithSchedulerTest method setUp.

@Before
public void setUp() {
    Retrofit retrofit = new Retrofit.Builder().baseUrl(server.url("/")).addCallAdapterFactory(RxJava2CallAdapterFactory.createWithScheduler(scheduler)).build();
    service = retrofit.create(Service.class);
}
Also used : Retrofit(retrofit2.Retrofit) Before(org.junit.Before)

Example 35 with Retrofit

use of retrofit2.Retrofit in project retrofit by square.

the class FlowableTest method setUp.

@Before
public void setUp() {
    Retrofit retrofit = new Retrofit.Builder().baseUrl(server.url("/")).addConverterFactory(new StringConverterFactory()).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).build();
    service = retrofit.create(Service.class);
}
Also used : Retrofit(retrofit2.Retrofit) Before(org.junit.Before)

Aggregations

Retrofit (retrofit2.Retrofit)81 Test (org.junit.Test)42 ToStringConverterFactory (retrofit2.helpers.ToStringConverterFactory)35 Before (org.junit.Before)34 MockResponse (okhttp3.mockwebserver.MockResponse)30 ResponseBody (okhttp3.ResponseBody)27 Type (java.lang.reflect.Type)25 IOException (java.io.IOException)22 OkHttpClient (okhttp3.OkHttpClient)22 ParameterizedType (java.lang.reflect.ParameterizedType)13 MediaType (okhttp3.MediaType)13 NonMatchingConverterFactory (retrofit2.helpers.NonMatchingConverterFactory)13 CountDownLatch (java.util.concurrent.CountDownLatch)12 AtomicReference (java.util.concurrent.atomic.AtomicReference)12 Gson (com.google.gson.Gson)11 GsonBuilder (com.google.gson.GsonBuilder)11 NonMatchingCallAdapterFactory (retrofit2.helpers.NonMatchingCallAdapterFactory)11 Converter (retrofit2.Converter)10 DelegatingCallAdapterFactory (retrofit2.helpers.DelegatingCallAdapterFactory)10 Annotation (java.lang.annotation.Annotation)9