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.
tasks/src/androidTest/java/org/tasks/injection/InjectingTestCase.java

27 lines
634 B
Java

package org.tasks.injection;
import android.test.AndroidTestCase;
import com.todoroo.andlib.service.ContextManager;
import dagger.ObjectGraph;
public abstract class InjectingTestCase extends AndroidTestCase {
@Override
protected void setUp() {
ContextManager.setContext(getContext());
ObjectGraph objectGraph = ObjectGraph.create(new TestModule(getContext()));
Object extension = getModule();
if (extension != null) {
objectGraph = objectGraph.plus(extension);
}
objectGraph.inject(this);
}
protected Object getModule() {
return null;
}
}