mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fix TestCommonsApplication compilation errors
Follows up e1afa6081e (#1062)
This commit is contained in:
parent
813cb1093e
commit
9acf22b5b2
1 changed files with 16 additions and 20 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package fr.free.nrw.commons;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.support.v4.util.LruCache;
|
||||
|
||||
|
|
@ -54,47 +55,36 @@ public class TestCommonsApplication extends CommonsApplication {
|
|||
@Override
|
||||
public void onCreate() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
super.onCreate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RefWatcher setupLeakCanary() {
|
||||
// No leakcanary in unit tests.
|
||||
return RefWatcher.DISABLED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonsApplicationComponent injector() {
|
||||
if (mockApplicationComponent == null) {
|
||||
mockApplicationComponent = DaggerCommonsApplicationComponent.builder()
|
||||
.appModule(new CommonsApplicationModule(this) {
|
||||
@Override
|
||||
public AccountUtil providesAccountUtil() {
|
||||
public AccountUtil providesAccountUtil(Context context) {
|
||||
return accountUtil;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences providesApplicationSharedPreferences() {
|
||||
public SharedPreferences providesApplicationSharedPreferences(Context context) {
|
||||
return appSharedPreferences;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences providesDefaultSharedPreferences() {
|
||||
public SharedPreferences providesDefaultSharedPreferences(Context context) {
|
||||
return defaultSharedPreferences;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences providesOtherSharedPreferences() {
|
||||
public SharedPreferences providesOtherSharedPreferences(Context context) {
|
||||
return otherSharedPreferences;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UploadController providesUploadController(SessionManager sessionManager, SharedPreferences sharedPreferences) {
|
||||
public UploadController providesUploadController(Context context, SessionManager sessionManager, SharedPreferences sharedPreferences) {
|
||||
return uploadController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SessionManager providesSessionManager(MediaWikiApi mediaWikiApi) {
|
||||
public SessionManager providesSessionManager(Context context, MediaWikiApi mediaWikiApi) {
|
||||
return sessionManager;
|
||||
}
|
||||
|
||||
|
|
@ -104,7 +94,7 @@ public class TestCommonsApplication extends CommonsApplication {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LocationServiceManager provideLocationServiceManager() {
|
||||
public LocationServiceManager provideLocationServiceManager(Context context) {
|
||||
return locationServiceManager;
|
||||
}
|
||||
|
||||
|
|
@ -114,7 +104,7 @@ public class TestCommonsApplication extends CommonsApplication {
|
|||
}
|
||||
|
||||
@Override
|
||||
public DBOpenHelper provideDBOpenHelper() {
|
||||
public DBOpenHelper provideDBOpenHelper(Context context) {
|
||||
return dbOpenHelper;
|
||||
}
|
||||
|
||||
|
|
@ -129,7 +119,13 @@ public class TestCommonsApplication extends CommonsApplication {
|
|||
}
|
||||
}).build();
|
||||
}
|
||||
return mockApplicationComponent;
|
||||
super.onCreate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RefWatcher setupLeakCanary() {
|
||||
// No leakcanary in unit tests.
|
||||
return RefWatcher.DISABLED;
|
||||
}
|
||||
|
||||
public AccountUtil getAccountUtil() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue