Search in sources :

Example 1 with SCDLModule

use of net.rdrei.android.scdl2.guice.SCDLModule in project scdl by passy.

the class TestHelper method overridenInjector.

public static void overridenInjector(Object instance, AbstractModule module) {
    final Application app = Robolectric.application;
    // Allow overriding of integrated classes like Activity
    Module moduleOverride = Modules.override(RoboGuice.newDefaultRoboModule(app)).with(module);
    // Also allow overriding custom bindings like URLWrapper
    moduleOverride = Modules.override(new SCDLModule()).with(moduleOverride);
    RoboGuice.setBaseApplicationInjector(app, RoboGuice.DEFAULT_STAGE, moduleOverride);
    final Injector injector = TestHelper.getInjector();
    injector.injectMembers(instance);
}
Also used : SCDLModule(net.rdrei.android.scdl2.guice.SCDLModule) Injector(com.google.inject.Injector) Module(com.google.inject.Module) SCDLModule(net.rdrei.android.scdl2.guice.SCDLModule) AbstractModule(com.google.inject.AbstractModule) Application(android.app.Application)

Aggregations

Application (android.app.Application)1 AbstractModule (com.google.inject.AbstractModule)1 Injector (com.google.inject.Injector)1 Module (com.google.inject.Module)1 SCDLModule (net.rdrei.android.scdl2.guice.SCDLModule)1