@Test public void testInitFromReplyToAllMessage() throws Exception { Message message = mock(Message.class); when(replyToParser.getRecipientsToReplyTo(message, account)).thenReturn(TO_ADDRESSES); ReplyToAddresses replyToAddresses = new ReplyToAddresses(ALL_TO_ADDRESSES, ALL_CC_ADDRESSES); when(replyToParser.getRecipientsToReplyAllTo(message, account)).thenReturn(replyToAddresses); recipientPresenter.initFromReplyToMessage(message, ReplyMode.ALL); runBackgroundTask(); runBackgroundTask(); verify(recipientMvpView).addRecipients(eq(RecipientType.TO), any(Recipient.class)); verify(recipientMvpView).addRecipients(eq(RecipientType.CC), any(Recipient.class)); }
public void initFromReplyToMessage(Message message, ReplyMode replyMode) { ReplyToAddresses replyToAddresses; switch (replyMode) { case ALL: replyToAddresses = replyToParser.getRecipientsToReplyAllTo(message, account); break; case LIST: replyToAddresses = replyToParser.getRecipientsToReplyListTo(message, account); break; case NORMAL: replyToAddresses = replyToParser.getRecipientsToReplyTo(message, account); break; default: throw new IllegalArgumentException("Unexpected reply mode: " + replyMode); } addToAddresses(replyToAddresses.to); addCcAddresses(replyToAddresses.cc); boolean shouldSendAsPgpInline = composePgpInlineDecider.shouldReplyInline(message); if (shouldSendAsPgpInline) { cryptoEnablePgpInline = true; } boolean shouldEnablePgpByDefault = composePgpEnableByDefaultDecider.shouldEncryptByDefault(message); currentCryptoMode = shouldEnablePgpByDefault ? CryptoMode.CHOICE_ENABLED : CryptoMode.NO_CHOICE; }
RecipientPresenter implements PermissionPingCallback { public void initFromReplyToMessage(Message message, ReplyMode replyMode) { ReplyToAddresses replyToAddresses; switch (replyMode) { case ALL: replyToAddresses = replyToParser.getRecipientsToReplyAllTo(message, account); break; case LIST: replyToAddresses = replyToParser.getRecipientsToReplyListTo(message, account); break; case NORMAL: replyToAddresses = replyToParser.getRecipientsToReplyTo(message, account); break; default: throw new IllegalArgumentException("Unexpected reply mode: " + replyMode); } addToAddresses(replyToAddresses.to); addCcAddresses(replyToAddresses.cc); boolean shouldSendAsPgpInline = composePgpInlineDecider.shouldReplyInline(message); if (shouldSendAsPgpInline) { cryptoEnablePgpInline = true; } boolean shouldEnablePgpByDefault = composePgpEnableByDefaultDecider.shouldEncryptByDefault(message); currentCryptoMode = shouldEnablePgpByDefault ? CryptoMode.CHOICE_ENABLED : CryptoMode.NO_CHOICE; } }
RecipientPresenter implements PermissionPingCallback { public void initFromReplyToMessage(Message message, ReplyMode replyMode) { ReplyToAddresses replyToAddresses; switch (replyMode) { case ALL: replyToAddresses = replyToParser.getRecipientsToReplyAllTo(message, account); break; case LIST: replyToAddresses = replyToParser.getRecipientsToReplyListTo(message, account); break; case NORMAL: replyToAddresses = replyToParser.getRecipientsToReplyTo(message, account); break; default: throw new IllegalArgumentException("Unexpected reply mode: " + replyMode); } addToAddresses(replyToAddresses.to); addCcAddresses(replyToAddresses.cc); boolean shouldSendAsPgpInline = composePgpInlineDecider.shouldReplyInline(message); if (shouldSendAsPgpInline) { cryptoEnablePgpInline = true; } boolean shouldEnablePgpByDefault = composePgpEnableByDefaultDecider.shouldEncryptByDefault(message); currentCryptoMode = shouldEnablePgpByDefault ? CryptoMode.CHOICE_ENABLED : CryptoMode.NO_CHOICE; } RecipientPresenter(Context context, LoaderManager loaderManager,
            RecipientMvpView recipientMvpView, Account account, ComposePgpInlineDecider composePgpInlineDecider,
            ComposePgpEnableByDefaultDecider composePgpEnableByDefaultDecider,
            AutocryptStatusInteractor autocryptStatusInteractor,
            ReplyToParser replyToParser, RecipientsChangedListener recipientsChangedListener); }
RecipientPresenter implements PermissionPingCallback { public void initFromReplyToMessage(Message message, ReplyMode replyMode) { ReplyToAddresses replyToAddresses; switch (replyMode) { case ALL: replyToAddresses = replyToParser.getRecipientsToReplyAllTo(message, account); break; case LIST: replyToAddresses = replyToParser.getRecipientsToReplyListTo(message, account); break; case NORMAL: replyToAddresses = replyToParser.getRecipientsToReplyTo(message, account); break; default: throw new IllegalArgumentException("Unexpected reply mode: " + replyMode); } addToAddresses(replyToAddresses.to); addCcAddresses(replyToAddresses.cc); boolean shouldSendAsPgpInline = composePgpInlineDecider.shouldReplyInline(message); if (shouldSendAsPgpInline) { cryptoEnablePgpInline = true; } boolean shouldEnablePgpByDefault = composePgpEnableByDefaultDecider.shouldEncryptByDefault(message); currentCryptoMode = shouldEnablePgpByDefault ? CryptoMode.CHOICE_ENABLED : CryptoMode.NO_CHOICE; } RecipientPresenter(Context context, LoaderManager loaderManager,
            RecipientMvpView recipientMvpView, Account account, ComposePgpInlineDecider composePgpInlineDecider,
            ComposePgpEnableByDefaultDecider composePgpEnableByDefaultDecider,
            AutocryptStatusInteractor autocryptStatusInteractor,
            ReplyToParser replyToParser, RecipientsChangedListener recipientsChangedListener); List<Address> getToAddresses(); List<Address> getCcAddresses(); List<Address> getBccAddresses(); boolean checkRecipientsOkForSending(); void initFromReplyToMessage(Message message, ReplyMode replyMode); void initFromTrustIdAction(String trustId); void initFromMailto(MailTo mailTo); void initFromSendOrViewIntent(Intent intent); void onRestoreInstanceState(Bundle savedInstanceState); void onSaveInstanceState(Bundle outState); void initFromDraftMessage(Message message); void addBccAddresses(Address... bccRecipients); void onPrepareOptionsMenu(Menu menu); void onSwitchAccount(Account account); @SuppressWarnings("UnusedParameters") void onSwitchIdentity(Identity identity); void asyncUpdateCryptoStatus(); @Nullable ComposeCryptoStatus getCurrentCachedCryptoStatus(); boolean isForceTextMessageFormat(); void onCryptoModeChanged(CryptoMode cryptoMode); void onCryptoPgpInlineChanged(boolean enablePgpInline); void onMenuAddFromContacts(); void onActivityResult(int requestCode, int resultCode, Intent data); void onNonRecipientFieldFocused(); void showPgpSendError(SendErrorState sendErrorState); @Override void onPgpPermissionCheckResult(Intent result); void onActivityDestroy(); void builderSetProperties(MessageBuilder messageBuilder); void builderSetProperties(PgpMessageBuilder pgpMessageBuilder, ComposeCryptoStatus cryptoStatus); void onMenuSetPgpInline(boolean enablePgpInline); void onMenuSetSignOnly(boolean enableSignOnly); void onMenuSetEnableEncryption(boolean enableEncryption); void onCryptoPgpClickDisable(); void onCryptoPgpSignOnlyDisabled(); boolean shouldSaveRemotely(); }
RecipientPresenter implements PermissionPingCallback { public void initFromReplyToMessage(Message message, ReplyMode replyMode) { ReplyToAddresses replyToAddresses; switch (replyMode) { case ALL: replyToAddresses = replyToParser.getRecipientsToReplyAllTo(message, account); break; case LIST: replyToAddresses = replyToParser.getRecipientsToReplyListTo(message, account); break; case NORMAL: replyToAddresses = replyToParser.getRecipientsToReplyTo(message, account); break; default: throw new IllegalArgumentException("Unexpected reply mode: " + replyMode); } addToAddresses(replyToAddresses.to); addCcAddresses(replyToAddresses.cc); boolean shouldSendAsPgpInline = composePgpInlineDecider.shouldReplyInline(message); if (shouldSendAsPgpInline) { cryptoEnablePgpInline = true; } boolean shouldEnablePgpByDefault = composePgpEnableByDefaultDecider.shouldEncryptByDefault(message); currentCryptoMode = shouldEnablePgpByDefault ? CryptoMode.CHOICE_ENABLED : CryptoMode.NO_CHOICE; } RecipientPresenter(Context context, LoaderManager loaderManager,
            RecipientMvpView recipientMvpView, Account account, ComposePgpInlineDecider composePgpInlineDecider,
            ComposePgpEnableByDefaultDecider composePgpEnableByDefaultDecider,
            AutocryptStatusInteractor autocryptStatusInteractor,
            ReplyToParser replyToParser, RecipientsChangedListener recipientsChangedListener); List<Address> getToAddresses(); List<Address> getCcAddresses(); List<Address> getBccAddresses(); boolean checkRecipientsOkForSending(); void initFromReplyToMessage(Message message, ReplyMode replyMode); void initFromTrustIdAction(String trustId); void initFromMailto(MailTo mailTo); void initFromSendOrViewIntent(Intent intent); void onRestoreInstanceState(Bundle savedInstanceState); void onSaveInstanceState(Bundle outState); void initFromDraftMessage(Message message); void addBccAddresses(Address... bccRecipients); void onPrepareOptionsMenu(Menu menu); void onSwitchAccount(Account account); @SuppressWarnings("UnusedParameters") void onSwitchIdentity(Identity identity); void asyncUpdateCryptoStatus(); @Nullable ComposeCryptoStatus getCurrentCachedCryptoStatus(); boolean isForceTextMessageFormat(); void onCryptoModeChanged(CryptoMode cryptoMode); void onCryptoPgpInlineChanged(boolean enablePgpInline); void onMenuAddFromContacts(); void onActivityResult(int requestCode, int resultCode, Intent data); void onNonRecipientFieldFocused(); void showPgpSendError(SendErrorState sendErrorState); @Override void onPgpPermissionCheckResult(Intent result); void onActivityDestroy(); void builderSetProperties(MessageBuilder messageBuilder); void builderSetProperties(PgpMessageBuilder pgpMessageBuilder, ComposeCryptoStatus cryptoStatus); void onMenuSetPgpInline(boolean enablePgpInline); void onMenuSetSignOnly(boolean enableSignOnly); void onMenuSetEnableEncryption(boolean enableEncryption); void onCryptoPgpClickDisable(); void onCryptoPgpSignOnlyDisabled(); boolean shouldSaveRemotely();  }