I've been struggling around with this test. I want to test my created ContentProvider, using RoboGuice.
Currently the ContentProvider I have extends from RoboContentProvider.
However, I'm not being able to Make It Run.
It says there's no implementation for an Interface. However, the modules are being defined and so one.
Here's the code for the setUp Method on the AndroidTestCase.
@Override
public void setUp() {
Context context = InstrumentationRegistry.getTargetContext();
Application app = null;
try {
app = InstrumentationRegistry
.getInstrumentation()
.newApplication(Application.class.getClassLoader(), Application.class.getName(), context);
RoboGuice.setUseAnnotationDatabases(false);
RoboGuice.overrideApplicationInjector(app,
RoboGuice.newDefaultRoboModule(app),
new DatabaseModule(app)
);
mContentResolver = new MockContentResolver();
mContentProvider = new MobiModelsContentProvider();
mContentProvider.attachInfo(app, null);
mContentResolver.addProvider("com.authority.models.test", mContentProvider);
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}