Search in sources :

Example 1 with ApplicationPreferences

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

the class AdViewManagerTest method setUp.

@Before
public void setUp() {
    mActivity = Robolectric.buildActivity(Activity.class).create().get();
    final ApplicationPreferences preferences = new ApplicationPreferences() {

        @Override
        public boolean isAdFree() {
            return mAdFree;
        }
    };
    AbstractModule module = new AbstractModule() {

        @Override
        protected void configure() {
            bind(ApplicationPreferences.class).toInstance(preferences);
            bind(ActivityLayoutInflater.class).toInstance(new TestLayoutInflater(mActivity));
        }
    };
    final ContextScope contextScope = new ContextScope(Robolectric.application);
    contextScope.enter(mActivity);
    try {
        TestHelper.overridenInjector(this, module);
    } finally {
        contextScope.exit(mActivity);
    }
}
Also used : ActivityLayoutInflater(net.rdrei.android.scdl2.guice.ActivityLayoutInflater) ContextScope(roboguice.inject.ContextScope) Activity(android.app.Activity) ApplicationPreferences(net.rdrei.android.scdl2.ApplicationPreferences) AbstractModule(com.google.inject.AbstractModule) Before(org.junit.Before)

Aggregations

Activity (android.app.Activity)1 AbstractModule (com.google.inject.AbstractModule)1 ApplicationPreferences (net.rdrei.android.scdl2.ApplicationPreferences)1 ActivityLayoutInflater (net.rdrei.android.scdl2.guice.ActivityLayoutInflater)1 Before (org.junit.Before)1 ContextScope (roboguice.inject.ContextScope)1