@Test public void browserSwitchWithUri_startsBrowserSwitch() { sut.browserSwitchClient = browserSwitchClient; sut.browserSwitch(123, "https: Uri uri = Uri.parse("https: ArgumentCaptor<BrowserSwitchOptions> captor = ArgumentCaptor.forClass(BrowserSwitchOptions.class); verify(browserSwitchClient).start(captor.capture(), same(sut)); BrowserSwitchOptions browserSwitchOptions = captor.getValue(); assertEquals(browserSwitchOptions.getRequestCode(), 123); assertEquals(browserSwitchOptions.getUrl(), uri); }
@SuppressWarnings("WeakerAccess") public void browserSwitch(int requestCode, String url) { BrowserSwitchOptions browserSwitchOptions = new BrowserSwitchOptions() .requestCode(requestCode) .url(Uri.parse(url)); browserSwitchClient.start(browserSwitchOptions, this); }
BrowserSwitchFragment extends Fragment implements BrowserSwitchListener { @SuppressWarnings("WeakerAccess") public void browserSwitch(int requestCode, String url) { BrowserSwitchOptions browserSwitchOptions = new BrowserSwitchOptions() .requestCode(requestCode) .url(Uri.parse(url)); browserSwitchClient.start(browserSwitchOptions, this); } }
BrowserSwitchFragment extends Fragment implements BrowserSwitchListener { @SuppressWarnings("WeakerAccess") public void browserSwitch(int requestCode, String url) { BrowserSwitchOptions browserSwitchOptions = new BrowserSwitchOptions() .requestCode(requestCode) .url(Uri.parse(url)); browserSwitchClient.start(browserSwitchOptions, this); }  }
BrowserSwitchFragment extends Fragment implements BrowserSwitchListener { @SuppressWarnings("WeakerAccess") public void browserSwitch(int requestCode, String url) { BrowserSwitchOptions browserSwitchOptions = new BrowserSwitchOptions() .requestCode(requestCode) .url(Uri.parse(url)); browserSwitchClient.start(browserSwitchOptions, this); }  @Override void onAttach(@NonNull Context context); @Override void onCreate(Bundle savedInstanceState); @Override void onResume(); String getReturnUrlScheme(); @SuppressWarnings("WeakerAccess") void browserSwitch(int requestCode, String url); @SuppressWarnings("WeakerAccess") void browserSwitch(int requestCode, Intent intent); void browserSwitch(BrowserSwitchOptions browserSwitchOptions); abstract void onBrowserSwitchResult(int requestCode, BrowserSwitchResult result, @Nullable Uri returnUri); }
BrowserSwitchFragment extends Fragment implements BrowserSwitchListener { @SuppressWarnings("WeakerAccess") public void browserSwitch(int requestCode, String url) { BrowserSwitchOptions browserSwitchOptions = new BrowserSwitchOptions() .requestCode(requestCode) .url(Uri.parse(url)); browserSwitchClient.start(browserSwitchOptions, this); }  @Override void onAttach(@NonNull Context context); @Override void onCreate(Bundle savedInstanceState); @Override void onResume(); String getReturnUrlScheme(); @SuppressWarnings("WeakerAccess") void browserSwitch(int requestCode, String url); @SuppressWarnings("WeakerAccess") void browserSwitch(int requestCode, Intent intent); void browserSwitch(BrowserSwitchOptions browserSwitchOptions); abstract void onBrowserSwitchResult(int requestCode, BrowserSwitchResult result, @Nullable Uri returnUri);  }