Utils { public static void openUrl(String url, Context context) { if (!url.startsWith("http: url = "http: } Intent browserIntent = new Intent( Intent.ACTION_VIEW, Uri.parse(url) ); context.startActivity(browserIntent); }  static void openUrl(String url, Context context); static boolean isOnline(Context context);  }
@Test public void testShouldOpenUrl() throws Exception { String url = "https: Utils.openUrl(url, context); ArgumentCaptor<Intent> argument = ArgumentCaptor.forClass(Intent.class); verify(context).startActivity(argument.capture()); }