Search in sources :

Example 6 with MockApplication

use of android.test.mock.MockApplication in project AndroidTraining by mixi-inc.

the class ScopedAnnotationInjectionTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    mMockApplication = new MockApplication();
    Proton.initialize(mMockApplication, new DefaultModule() {

        @Override
        protected void configure() {
            super.configure();
            bind(ApplicationScopedClass.class).to(ApplicationScopedClassImpl.class);
            bind(ContextScopedClass.class).to(ContextScopedClassImpl.class);
            bind(DependentScopedClass.class).to(DependentScopedClassImpl.class);
        }
    });
    mInjector = Proton.getInjector(new MockContext(mMockApplication));
}
Also used : MockApplication(android.test.mock.MockApplication)

Example 7 with MockApplication

use of android.test.mock.MockApplication in project AndroidTraining by mixi-inc.

the class FieldListenerTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    mMockApplication = new MockApplication();
    Proton.initialize(mMockApplication, new DefaultModule() {

        @Override
        protected void configure() {
            super.configure();
            bindFieldListener(TestAnnotation.class, FieldListenerTest.this);
        }
    });
    mInjector = Proton.getInjector(new MockContext(mMockApplication));
}
Also used : MockContext(proton.inject.MockContext) MockApplication(android.test.mock.MockApplication) DefaultModule(proton.inject.DefaultModule)

Example 8 with MockApplication

use of android.test.mock.MockApplication in project AndroidTraining by mixi-inc.

the class ProviderListenerTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    mMockApplication = new MockApplication();
    Proton.initialize(mMockApplication, new DefaultModule() {

        @Override
        protected void configure() {
            super.configure();
            bindProviderListener(ProviderListenerTest.this);
            bind(Aaa.class);
        }
    });
    mInjector = Proton.getInjector(new MockContext(mMockApplication));
}
Also used : MockContext(proton.inject.MockContext) MockApplication(android.test.mock.MockApplication) DefaultModule(proton.inject.DefaultModule)

Example 9 with MockApplication

use of android.test.mock.MockApplication in project AndroidTraining by mixi-inc.

the class ApplicationScopedInjectionTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    mMockApplication = new MockApplication();
    Proton.initialize(mMockApplication, new DefaultModule() {

        @Override
        protected void configure() {
            super.configure();
            bind(Client.class);
            bind(ApplicationScopedClass.class).in(ApplicationScoped.class);
            bind(IllegalApplicationScopedClass.class).in(ApplicationScoped.class);
            bind(ContextScopedClass.class);
        }
    });
}
Also used : MockApplication(android.test.mock.MockApplication) ApplicationScoped(proton.inject.scope.ApplicationScoped)

Example 10 with MockApplication

use of android.test.mock.MockApplication in project AndroidTraining by mixi-inc.

the class ConstructorInjectionTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    mMockApplication = new MockApplication();
    Proton.initialize(mMockApplication, new DefaultModule() {

        @Override
        protected void configure() {
            super.configure();
            bind(Client.class);
            bind(Aaa.class).to(AaaImp.class);
            bind(Bbb.class).to(BbbImp.class);
            bind(Ccc.class).to(CccImp.class);
        }
    });
    mInjector = Proton.getInjector(new MockContext(mMockApplication));
}
Also used : MockApplication(android.test.mock.MockApplication)

Aggregations

MockApplication (android.test.mock.MockApplication)26 ComponentName (android.content.ComponentName)5 ActivityInfo (android.content.pm.ActivityInfo)5 IBinder (android.os.IBinder)5 Random (java.util.Random)5 DefaultModule (proton.inject.DefaultModule)4 MockContext (proton.inject.MockContext)4 ApplicationScoped (proton.inject.scope.ApplicationScoped)3 ActivityNotFoundException (android.content.ActivityNotFoundException)1 TypedArray (android.content.res.TypedArray)1 RemoteException (android.os.RemoteException)1 ActionBarActivity (android.support.v7.app.ActionBarActivity)1 SuperStartActivity (org.holoeverywhere.ThemeManager.SuperStartActivity)1 IAddonActivity (org.holoeverywhere.addon.IAddonActivity)1 Activity (org.holoeverywhere.app.Activity)1 Application (org.holoeverywhere.app.Application)1 ObserverManager (proton.inject.observer.ObserverManager)1 Dependent (proton.inject.scope.Dependent)1