ServerSearchActivity extends BaseActivity implements ServerSearchView { @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); boolean isSuccess = resultCode == RESULT_OK; if (!isSuccess) return; ServerModel serverModel = data.getExtras().getParcelable(ServerFoundActivity.KEY_SERVER); presenter.onNavigationResult(requestCode, isSuccess, serverModel); }  @NonNull static Intent getCallingIntent(Context context); @Deprecated static Intent getCallingIntent(Context context, ServerModel serverModel); @Override void onBackPressed(); @Override void navigateToServerDetail(ServerModel serverModel); @Override void navigateToMainScreen(ServerModel serverModel); @Override void showMessage(String message); @Override void showError(Exception exception); @Override void closeMenu(); @Override void showLoading(); @Override void hideLoading(); @Override void startQrScanner(); @Override void stopQrScanner(); @Override void showEnterNetworkAddressDialog(); @Override void showWifiState(int wifiStrenghtLevel); @OnClick(R.id.button_fab_wifi) void onFabWifiButtonClick(View view); @OnClick(R.id.button_fab_qr) void onFabQrButtonClick(View view); @OnClick(R.id.button_fab_ip) void onFabIpButtonClick(View view); @OnClick(R.id.button_close_camera) void onCloseCameraButtonClick(View view);  }
@Test public void shouldProcessActivityResult() throws Exception { Intent mockIntent = mock(Intent.class); Bundle mockBundle = mock(Bundle.class); ServerModel mockServerModel = mock(ServerModel.class); when(mockBundle.getParcelable("server")).thenReturn(mockServerModel); when(mockIntent.getExtras()).thenReturn(mockBundle); serverSearchActivity.onActivityResult(12345, -1, mockIntent); verify(mockBundle, times(1)).getParcelable("server"); verify(mockIntent, times(1)).getExtras(); verify(mockServerSearchPresenter).onNavigationResult(12345, true, mockServerModel); }