@Test public void buildSign__withUserInteractionResult__shouldReturnUserInteraction() throws MessagingException { cryptoStatusBuilder.setCryptoMode(CryptoMode.SIGN_ONLY); pgpMessageBuilder.setCryptoStatus(cryptoStatusBuilder.build()); Intent returnIntent = mock(Intent.class); when(returnIntent.getIntExtra(eq(OpenPgpApi.RESULT_CODE), anyInt())) .thenReturn(OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED); final PendingIntent mockPendingIntent = mock(PendingIntent.class); when(returnIntent.getParcelableExtra(eq(OpenPgpApi.RESULT_INTENT))) .thenReturn(mockPendingIntent); when(openPgpApi.executeApi(any(Intent.class), any(OpenPgpDataSource.class), any(OutputStream.class))) .thenReturn(returnIntent); Callback mockCallback = mock(Callback.class); pgpMessageBuilder.buildAsync(mockCallback); ArgumentCaptor<PendingIntent> captor = ArgumentCaptor.forClass(PendingIntent.class); verify(mockCallback).onMessageBuildReturnPendingIntent(captor.capture(), anyInt()); verifyNoMoreInteractions(mockCallback); PendingIntent pendingIntent = captor.getValue(); Assert.assertSame(pendingIntent, mockPendingIntent); }
public void setCryptoStatus(ComposeCryptoStatus cryptoStatus) { this.cryptoStatus = cryptoStatus; }
PgpMessageBuilder extends MessageBuilder { public void setCryptoStatus(ComposeCryptoStatus cryptoStatus) { this.cryptoStatus = cryptoStatus; } }
PgpMessageBuilder extends MessageBuilder { public void setCryptoStatus(ComposeCryptoStatus cryptoStatus) { this.cryptoStatus = cryptoStatus; } @VisibleForTesting  PgpMessageBuilder(Context context, MessageIdGenerator messageIdGenerator, BoundaryGenerator boundaryGenerator,
            AutocryptOperations autocryptOperations, AutocryptOpenPgpApiInteractor autocryptOpenPgpApiInteractor); }
PgpMessageBuilder extends MessageBuilder { public void setCryptoStatus(ComposeCryptoStatus cryptoStatus) { this.cryptoStatus = cryptoStatus; } @VisibleForTesting  PgpMessageBuilder(Context context, MessageIdGenerator messageIdGenerator, BoundaryGenerator boundaryGenerator,
            AutocryptOperations autocryptOperations, AutocryptOpenPgpApiInteractor autocryptOpenPgpApiInteractor); static PgpMessageBuilder newInstance(); void setOpenPgpApi(OpenPgpApi openPgpApi); @Override void buildMessageOnActivityResult(int requestCode, @NonNull Intent userInteractionResult); void setCryptoStatus(ComposeCryptoStatus cryptoStatus); }
PgpMessageBuilder extends MessageBuilder { public void setCryptoStatus(ComposeCryptoStatus cryptoStatus) { this.cryptoStatus = cryptoStatus; } @VisibleForTesting  PgpMessageBuilder(Context context, MessageIdGenerator messageIdGenerator, BoundaryGenerator boundaryGenerator,
            AutocryptOperations autocryptOperations, AutocryptOpenPgpApiInteractor autocryptOpenPgpApiInteractor); static PgpMessageBuilder newInstance(); void setOpenPgpApi(OpenPgpApi openPgpApi); @Override void buildMessageOnActivityResult(int requestCode, @NonNull Intent userInteractionResult); void setCryptoStatus(ComposeCryptoStatus cryptoStatus);  }