// private ListView _lvMasterList;
  //	private EditText _etSearch;
  //	private ImageButton _btnSearch;
  @Before
  public void setup() {
    RoboGuice.setBaseApplicationInjector(
        Robolectric.application,
        RoboGuice.DEFAULT_STAGE,
        Modules.override(RoboGuice.newDefaultRoboModule(Robolectric.application))
            .with(new EmptyGroceryFilesModule()));

    super.setup();
    // Override the default RoboGuice module

    try {
      _activity =
          (EditMasterListActivity) shadowOf(super.editMasterList()).getIntentClass().newInstance();
      _activity.onCreate(null);
    } catch (Exception e) {
      fail(e.getMessage());
    }
    // _lvMasterList = (ListView) _activity.findViewById(R.id.masterlist);

    _btnAdd = (ImageButton) this._activity.findViewById(R.id.add_button);

    //	_etSearch = (EditText) this._activity.findViewById(R.id.search_text);

    //	_btnSearch = (Button) _currentListActivity.findViewById(R.id.search_button);

  }
 @Test(expected = ConfigurationException.class)
 public void shouldNotStaticallyInjectPreferenceViews() {
   RoboGuice.setBaseApplicationInjector(
       Robolectric.application,
       Stage.DEVELOPMENT,
       RoboGuice.newDefaultRoboModule(Robolectric.application),
       new ModuleC());
   @SuppressWarnings("unused")
   final C c = Robolectric.buildActivity(C.class).create().get();
 }
Пример #3
0
 protected void glueInjections() {
   addBindings();
   if (!module.isEmpty()) {
     Injector injector =
         RoboGuice.getOrCreateBaseApplicationInjector(
             RuntimeEnvironment.application,
             RoboGuice.DEFAULT_STAGE,
             (Module) RoboGuice.newDefaultRoboModule(RuntimeEnvironment.application),
             module);
     inject(injector);
   }
 }
 public static void setUp(Object testObject, TestGuiceModule module, Module productionModule) {
   Module roboGuiceModule = RoboGuice.newDefaultRoboModule(Robolectric.application);
   Module testModule =
       productionModule != null
           ? Modules.override(roboGuiceModule, productionModule, new RobolectricModule())
               .with(module)
           : Modules.override(roboGuiceModule, new RobolectricModule()).with(module);
   RoboGuice.setBaseApplicationInjector(
       Robolectric.application, RoboGuice.DEFAULT_STAGE, testModule);
   RoboInjector injector = RoboGuice.getInjector(Robolectric.application);
   injector.injectMembers(testObject);
 }
    @Override
    public void prepareTest(Object test) {
      MySampleApplication application = (MySampleApplication) Robolectric.application;

      RoboGuice.setBaseApplicationInjector(
          application,
          RoboGuice.DEFAULT_STAGE,
          RoboGuice.newDefaultRoboModule(application),
          new TestApplicationModule());

      RoboGuice.getInjector(application).injectMembers(test);
      MockitoAnnotations.initMocks(test);
    }
Пример #6
0
  @Before
  public void setUp() {

    RoboGuice.setBaseApplicationInjector(
        Robolectric.application,
        RoboGuice.DEFAULT_STAGE,
        Modules.override(RoboGuice.newDefaultRoboModule(Robolectric.application)).with(testModule));

    quizzActivity = new QuizzActivity();

    RoboInjector injector = RoboGuice.getInjector(quizzActivity);
    injector.injectMembers(this);
  }
 @Before
 public void setup() {
   RoboGuice.setBaseApplicationInjector(
       Robolectric.application,
       Stage.DEVELOPMENT,
       RoboGuice.newDefaultRoboModule(Robolectric.application),
       new ModuleA());
   ActionBarSherlock.registerImplementation(ActionBarSherlockRobolectric.class);
   Intent intent =
       new Intent(Robolectric.application, DummySherlockActivity.class)
           .putExtra("foobar", "goober");
   activity =
       Robolectric.buildActivity(DummySherlockActivity.class).withIntent(intent).create().get();
 }
 public static void tearDown() {
   RoboGuice.util.reset();
   Application app = Robolectric.application;
   DefaultRoboModule defaultModule = RoboGuice.newDefaultRoboModule(app);
   RoboGuice.setBaseApplicationInjector(app, RoboGuice.DEFAULT_STAGE, defaultModule);
 }