mirror of https://github.com/tasks/tasks
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
634 B
Java
27 lines
634 B
Java
10 years ago
|
package org.tasks.injection;
|
||
|
|
||
10 years ago
|
import android.test.AndroidTestCase;
|
||
|
|
||
|
import com.todoroo.andlib.service.ContextManager;
|
||
10 years ago
|
|
||
10 years ago
|
import dagger.ObjectGraph;
|
||
10 years ago
|
|
||
10 years ago
|
public abstract class InjectingTestCase extends AndroidTestCase {
|
||
10 years ago
|
|
||
10 years ago
|
@Override
|
||
|
protected void setUp() {
|
||
10 years ago
|
ContextManager.setContext(getContext());
|
||
10 years ago
|
|
||
10 years ago
|
ObjectGraph objectGraph = ObjectGraph.create(new TestModule(getContext()));
|
||
|
Object extension = getModule();
|
||
|
if (extension != null) {
|
||
|
objectGraph = objectGraph.plus(extension);
|
||
|
}
|
||
|
objectGraph.inject(this);
|
||
10 years ago
|
}
|
||
10 years ago
|
|
||
10 years ago
|
protected Object getModule() {
|
||
|
return null;
|
||
10 years ago
|
}
|
||
|
}
|