@Test public void shouldGoToStockCardPageAfterAddedNewProduct(){ Intent intentToStockCard = new Intent(); intentToStockCard.putExtra(Constants.PARAM_IS_ADD_NEW_DRUG, true); initialInventoryActivity = Robolectric.buildActivity(InitialInventoryActivity.class, intentToStockCard).create().get(); initialInventoryActivity.goToNextPage(); Intent startIntent = shadowOf(initialInventoryActivity).getNextStartedActivity(); assertEquals(startIntent.getComponent().getClassName(), StockCardListActivity.class.getName()); assertEquals(startIntent.getFlags(), Intent.FLAG_ACTIVITY_CLEAR_TOP); }
@Override public void goToNextPage() { preferencesMgr.setIsNeedsInventory(false); startActivity(isAddNewDrug ? StockCardListActivity.getIntentToMe(this) : HomeActivity.getIntentToMe(this)); this.finish(); }
InitialInventoryActivity extends InventoryActivity { @Override public void goToNextPage() { preferencesMgr.setIsNeedsInventory(false); startActivity(isAddNewDrug ? StockCardListActivity.getIntentToMe(this) : HomeActivity.getIntentToMe(this)); this.finish(); } }
InitialInventoryActivity extends InventoryActivity { @Override public void goToNextPage() { preferencesMgr.setIsNeedsInventory(false); startActivity(isAddNewDrug ? StockCardListActivity.getIntentToMe(this) : HomeActivity.getIntentToMe(this)); this.finish(); }  }
InitialInventoryActivity extends InventoryActivity { @Override public void goToNextPage() { preferencesMgr.setIsNeedsInventory(false); startActivity(isAddNewDrug ? StockCardListActivity.getIntentToMe(this) : HomeActivity.getIntentToMe(this)); this.finish(); }  @Override void initUI(); @Override void goToNextPage(); @Override void onBackPressed(); static Intent getIntentToMe(Context context, boolean isAddNewDrug); static Intent getIntentToMe(Context context); }
InitialInventoryActivity extends InventoryActivity { @Override public void goToNextPage() { preferencesMgr.setIsNeedsInventory(false); startActivity(isAddNewDrug ? StockCardListActivity.getIntentToMe(this) : HomeActivity.getIntentToMe(this)); this.finish(); }  @Override void initUI(); @Override void goToNextPage(); @Override void onBackPressed(); static Intent getIntentToMe(Context context, boolean isAddNewDrug); static Intent getIntentToMe(Context context);  }