@Override
          public Void call() {
            // Check clipboard value.
            String clipboardContent = "";
            Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
            ClipboardManager clipboard =
                (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
            if (clipboard.hasPrimaryClip()
                && clipboard.getPrimaryClipDescription()
                    .hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN)) {
              clipboardContent = clipboard.getPrimaryClip().getItemAt(0).getText().toString();
            }
            assertThat(clipboardContent).isEqualTo(pin);
            return null;
          }
Unit tests for {@link AuthenticatorActivity} (part/shard 1).
javatests/com/google/android/apps/authenticator/AuthenticatorActivityTest.java