// 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);

  }
 @Before
 public void setUp() throws Exception {
   rnrFormRepository =
       RoboGuice.getInjector(RuntimeEnvironment.application).getInstance(RnrFormRepository.class);
   signatureRepository =
       RoboGuice.getInjector(RuntimeEnvironment.application)
           .getInstance(RnrFormSignatureRepository.class);
 }
 @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();
 }
 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);
 }
예제 #5
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);
   }
 }
예제 #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);
  }
    @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);
    }
 @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();
 }
  @Before
  public void setUp() throws LMISException, ParseException {
    itemView =
        LayoutInflater.from(RuntimeEnvironment.application)
            .inflate(R.layout.item_stock_movement, null, false);
    mockedListener = mock(StockMovementAdapter.MovementChangedListener.class);
    viewHolder = new StockMovementViewHolder(itemView, mockedListener);

    viewModel =
        new StockMovementViewModelBuilder()
            .withMovementDate("2015-11-11")
            .withDocumentNo("12345")
            .withNegativeAdjustment(null)
            .withPositiveAdjustment(null)
            .withIssued("30")
            .withReceived(null)
            .withStockExistence("70")
            .withIsDraft(false)
            .withMovementReason(
                new MovementReasonManager.MovementReason(
                    MovementReasonManager.MovementType.ISSUE, "ISSUE_1", "issue description"))
            .build();

    StockRepository stockRepository =
        RoboGuice.getInjector(RuntimeEnvironment.application).getInstance(StockRepository.class);

    stockCard = StockCardBuilder.saveStockCardWithOneMovement(stockRepository);
  }
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    RoboGuice.injectMembers(getInstrumentation().getTargetContext().getApplicationContext(), this);

    gist = new Gist();
    gist.id = "abcd";
    GistFilesMap files = new GistFilesMap();

    GistFile a = new GistFile();
    GistFile b = new GistFile();

    a.content = "aa";
    a.filename = "a";

    b.content = "bb";
    b.filename = "b";

    files.put("a", a);
    files.put("b", b);
    gist.files = files;
    store.addGist(gist);
    setActivityIntent(GistFilesViewActivity.createIntent(gist, 0));
  }
예제 #11
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   final RoboInjector injector = RoboGuice.getInjector(getActivity());
   eventManager = injector.getInstance(EventManager.class);
   injector.injectMembersWithoutViews(this);
   super.onCreate(savedInstanceState);
   eventManager.fire(new OnCreateEvent(savedInstanceState));
 }
 public CourseDiscussionResponsesAdapter(
     @NonNull Context context,
     @NonNull Listener listener,
     @NonNull DiscussionThread discussionThread) {
   this.context = context;
   this.discussionThread = discussionThread;
   this.listener = listener;
   RoboGuice.getInjector(context).injectMembers(this);
 }
 public DiscussionCommentsAdapter(
     @NonNull Context context,
     @NonNull Listener listener,
     @NonNull DiscussionThread thread,
     @NonNull DiscussionComment response) {
   this.context = context;
   this.listener = listener;
   this.thread = thread;
   this.response = response;
   RoboGuice.getInjector(context).injectMembers(this);
 }
예제 #14
0
 @Override
 protected void onDestroy() {
   try {
     eventManager.fire(new OnDestroyEvent());
   } finally {
     try {
       RoboGuice.destroyInjector(this);
     } finally {
       super.onDestroy();
     }
   }
 }
예제 #15
0
  @Test(expected = IllegalArgumentException.class)
  public void shouldNotBeAbleToExitTheWrongScope() {
    final ContextScope scope =
        RoboGuice.getOrCreateBaseApplicationInjector(Robolectric.application)
            .getInstance(ContextScope.class);
    final Activity a = Robolectric.buildActivity(A.class).get();
    final Activity b = Robolectric.buildActivity(B.class).get();

    scope.enter(a);
    scope.enter(b);
    scope.exit(a);
  }
예제 #16
0
  @Test
  public void shouldBeAbleToOpenMultipleScopes() {
    final ContextScope scope =
        RoboGuice.getOrCreateBaseApplicationInjector(Robolectric.application)
            .getInstance(ContextScope.class);
    final Activity a = Robolectric.buildActivity(A.class).get();
    final Activity b = Robolectric.buildActivity(B.class).get();

    scope.enter(a);
    scope.enter(b);
    scope.exit(b);
    scope.exit(a);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    // Perform dependency injection
    final RoboInjector injector = RoboGuice.getInjector(this.getApplicationContext());
    injector.injectMembersWithoutViews(this);

    // Get account and token type from intent
    accountType = getIntent().getStringExtra(AccountManager.KEY_ACCOUNT_TYPE);
    authTokenType = getIntent().getStringExtra(AccountManager.KEY_AUTHENTICATOR_TYPES);
    if (authTokenType == null) {
      authTokenType = AccountConstants.AUTHTOKEN_TYPE_FULL_ACCESS;
    }
    initViews();
    initListeners();
  }
 @Before
 public void setUp() throws Exception {
   syncErrorsRepository =
       RoboGuice.getInjector(RuntimeEnvironment.application)
           .getInstance(SyncErrorsRepository.class);
 }
예제 #19
0
 static {
   RoboGuice.setUseAnnotationDatabases(false);
 }
예제 #20
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   RoboGuice.getInjector(getActivity()).injectMembersWithoutViews(this);
 }
 @Override
 protected RnrFormRepository initRnrFormRepository() {
   mmiaRepository = RoboGuice.getInjector(LMISApp.getContext()).getInstance(MMIARepository.class);
   return mmiaRepository;
 }
 public ApiKeyExecutor(Context context, Bundle bundle) {
   super(context, bundle, AuthInfo.class, MAX_RETRY_COUNT);
   RoboGuice.injectMembers(context, this);
 }
 public PrefUtilities(@NonNull Context context) {
   mContext = context;
   preferences = PreferenceManager.getDefaultSharedPreferences(context);
   RoboGuice.injectMembers(context, this);
 }
 @Inject
 public ScheduledTaskRepaint(Context context) {
   // Log.d("DI", "ScheduledTaskRepaint creation started...");
   RoboGuice.getInjector(context).injectMembers(this);
   // Log.d("DI", "ScheduledTaskRepaint created!");
 }
예제 #25
0
 public NotificationManager(Context context) {
   RoboGuice.injectMembers(context, this);
   eventBus.register(this);
   this.context = context;
 }
 public static void tearDown() {
   RoboGuice.util.reset();
   Application app = Robolectric.application;
   DefaultRoboModule defaultModule = RoboGuice.newDefaultRoboModule(app);
   RoboGuice.setBaseApplicationInjector(app, RoboGuice.DEFAULT_STAGE, defaultModule);
 }
 public OauthRefreshTokenAuthenticator(Context context) {
   this.context = context;
   RoboGuice.injectMembers(context, this);
 }
예제 #28
0
 @Override
 public void onContentChanged() {
   super.onContentChanged();
   RoboGuice.getInjector(this).injectViewMembers(this);
   eventManager.fire(new OnContentChangedEvent());
 }
예제 #29
0
 @Override
 public void onViewCreated(View view, Bundle savedInstanceState) {
   super.onViewCreated(view, savedInstanceState);
   RoboGuice.getInjector(getActivity()).injectViewMembers(this);
 }