SketchSharer { public void shareSketch() { Uri shareUri = screenshotTaker.takeScreenshot(); if (shareUri == null) { return; } Resources resources = ContextRetriever.INSTANCE.getResources(); Intent intent = new Intent(Intent.ACTION_SEND) .setType(INTENT_TYPE) .putExtra(Intent.EXTRA_SUBJECT, resources.getString(R.string.share_subjet)) .putExtra(Intent.EXTRA_TEXT, resources.getString(R.string.share_text)) .putExtra(Intent.EXTRA_STREAM, shareUri); ContextRetriever.INSTANCE.getActivity().startActivity(intent); AnalyticsTracker.INSTANCE.trackShare(); } SketchSharer(ScreenshotTaker screenshotTaker); static SketchSharer newInstance(); void shareSketch();  }
@Ignore("This test requires being able to test an intent, will eventually fail") @Test public void testThatShareSketchStartsActivityWithActionChooser() { sketchSharer.shareSketch(); verify(ContextRetriever.INSTANCE.getActivity()).startActivity(intentCaptor.capture()); assertThat(intentCaptor.getValue().getAction()).isEqualTo(Intent.ACTION_CHOOSER); }