PhysicalInventoryActivity extends InventoryActivity { @Override protected void goToNextPage() { setResult(Activity.RESULT_OK); finish(); }  @Override void initUI(); void signPhysicalInventory(); @Override void onBackPressed(); static Intent getIntentToMe(Context context); void showSignDialog(); static final String KEY_FROM_PHYSICAL_COMPLETED; }
@Test public void shouldGoBackToParentPageWhenInventoryPageFinished(){ Intent intentFromParentActivity = new Intent(); intentFromParentActivity.putExtra(Constants.PARAM_IS_PHYSICAL_INVENTORY, true); Observable<List<InventoryViewModel>> value = Observable.create(new Observable.OnSubscribe<List<InventoryViewModel>>() { @Override public void call(Subscriber<? super List<InventoryViewModel>> subscriber) { } }); when(mockedPresenter.loadInventory()).thenReturn(value); physicalInventoryActivity = Robolectric.buildActivity(PhysicalInventoryActivity.class, intentFromParentActivity).create().get(); physicalInventoryActivity.goToNextPage(); assertTrue(physicalInventoryActivity.isFinishing()); }