@Test public void buildOpportunisticEncrypt__withNoKeysAndNoSignOnly__shouldNotBeSigned() throws MessagingException { ComposeCryptoStatus cryptoStatus = cryptoStatusBuilder .setRecipients(Collections.singletonList(new Recipient("test", "test@example.org", "labru", -1, "key"))) .setCryptoMode(CryptoMode.NO_CHOICE) .build(); pgpMessageBuilder.setCryptoStatus(cryptoStatus); Intent returnIntent = new Intent(); returnIntent.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR); returnIntent.putExtra(OpenPgpApi.RESULT_ERROR, new OpenPgpError(OpenPgpError.OPPORTUNISTIC_MISSING_KEYS, "Missing keys")); when(openPgpApi.executeApi(any(Intent.class), any(OpenPgpDataSource.class), any(OutputStream.class))) .thenReturn(returnIntent); Callback mockCallback = mock(Callback.class); pgpMessageBuilder.buildAsync(mockCallback); ArgumentCaptor<MimeMessage> captor = ArgumentCaptor.forClass(MimeMessage.class); verify(mockCallback).onMessageBuildSuccess(captor.capture(), eq(false)); verifyNoMoreInteractions(mockCallback); MimeMessage message = captor.getValue(); Assert.assertEquals("text/plain", message.getMimeType()); }
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);  }