mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-30 14:23:55 +01:00
Decouple from the data-client service factory, with some code cleanup in the process (#5496)
This commit is contained in:
parent
7ec2a22fce
commit
ab9e57f5be
10 changed files with 75 additions and 71 deletions
|
|
@ -4,7 +4,6 @@ import androidx.annotation.NonNull;
|
|||
|
||||
import org.wikipedia.dataclient.Service;
|
||||
import org.wikipedia.dataclient.SharedPreferenceCookieManager;
|
||||
import org.wikipedia.dataclient.WikiSite;
|
||||
import org.wikipedia.dataclient.okhttp.TestStubInterceptor;
|
||||
import org.wikipedia.dataclient.okhttp.UnsuccessfulResponseInterceptor;
|
||||
import org.wikipedia.login.LoginResult;
|
||||
|
|
@ -24,7 +23,7 @@ public class TestAppAdapter extends AppAdapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public OkHttpClient getOkHttpClient(@NonNull WikiSite wikiSite) {
|
||||
public OkHttpClient getOkHttpClient() {
|
||||
return new OkHttpClient.Builder()
|
||||
.addInterceptor(new UnsuccessfulResponseInterceptor())
|
||||
.addInterceptor(new TestStubInterceptor())
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ import org.junit.runner.RunWith;
|
|||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.wikipedia.AppAdapter;
|
||||
import org.wikipedia.TestAppAdapter;
|
||||
import org.wikipedia.dataclient.Service;
|
||||
import org.wikipedia.dataclient.WikiSite;
|
||||
import org.wikipedia.json.GsonUtil;
|
||||
|
||||
import okhttp3.Dispatcher;
|
||||
|
|
@ -25,7 +23,7 @@ public abstract class MockWebServerTest {
|
|||
|
||||
@Before public void setUp() throws Throwable {
|
||||
AppAdapter.set(new TestAppAdapter());
|
||||
OkHttpClient.Builder builder = AppAdapter.get().getOkHttpClient(new WikiSite(Service.WIKIPEDIA_URL)).newBuilder();
|
||||
OkHttpClient.Builder builder = AppAdapter.get().getOkHttpClient().newBuilder();
|
||||
okHttpClient = builder.dispatcher(new Dispatcher(new ImmediateExecutorService())).build();
|
||||
server.setUp();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue