@Test public void getRecipientsToReplyTo_should_return_from_otherwise() throws Exception { when(message.getReplyTo()).thenReturn(EMPTY_ADDRESSES); when(message.getHeader(ListHeaders.LIST_POST_HEADER)).thenReturn(new String[0]); when(message.getFrom()).thenReturn(FROM_ADDRESSES); ReplyToAddresses result = replyToParser.getRecipientsToReplyTo(message, account); assertArrayEquals(FROM_ADDRESSES, result.to); assertArrayEquals(EMPTY_ADDRESSES, result.cc); verify(account).isAnIdentity(result.to); }
public ReplyToAddresses getRecipientsToReplyTo(Message message, Account account) { Address[] candidateAddress; Address[] replyToAddresses = message.getReplyTo(); Address[] fromAddresses = message.getFrom(); if (replyToAddresses.length > 0) { candidateAddress = replyToAddresses; } else { candidateAddress = fromAddresses; } boolean replyToAddressIsUserIdentity = account.isAnIdentity(candidateAddress); if (replyToAddressIsUserIdentity) { candidateAddress = message.getRecipients(RecipientType.TO); } return new ReplyToAddresses(candidateAddress); }
ReplyToParser { public ReplyToAddresses getRecipientsToReplyTo(Message message, Account account) { Address[] candidateAddress; Address[] replyToAddresses = message.getReplyTo(); Address[] fromAddresses = message.getFrom(); if (replyToAddresses.length > 0) { candidateAddress = replyToAddresses; } else { candidateAddress = fromAddresses; } boolean replyToAddressIsUserIdentity = account.isAnIdentity(candidateAddress); if (replyToAddressIsUserIdentity) { candidateAddress = message.getRecipients(RecipientType.TO); } return new ReplyToAddresses(candidateAddress); } }
ReplyToParser { public ReplyToAddresses getRecipientsToReplyTo(Message message, Account account) { Address[] candidateAddress; Address[] replyToAddresses = message.getReplyTo(); Address[] fromAddresses = message.getFrom(); if (replyToAddresses.length > 0) { candidateAddress = replyToAddresses; } else { candidateAddress = fromAddresses; } boolean replyToAddressIsUserIdentity = account.isAnIdentity(candidateAddress); if (replyToAddressIsUserIdentity) { candidateAddress = message.getRecipients(RecipientType.TO); } return new ReplyToAddresses(candidateAddress); }  }
ReplyToParser { public ReplyToAddresses getRecipientsToReplyTo(Message message, Account account) { Address[] candidateAddress; Address[] replyToAddresses = message.getReplyTo(); Address[] fromAddresses = message.getFrom(); if (replyToAddresses.length > 0) { candidateAddress = replyToAddresses; } else { candidateAddress = fromAddresses; } boolean replyToAddressIsUserIdentity = account.isAnIdentity(candidateAddress); if (replyToAddressIsUserIdentity) { candidateAddress = message.getRecipients(RecipientType.TO); } return new ReplyToAddresses(candidateAddress); }  ReplyToAddresses getRecipientsToReplyTo(Message message, Account account); ReplyToAddresses getRecipientsToReplyListTo(Message message, Account account); ReplyToAddresses getRecipientsToReplyAllTo(Message message, Account account); }
ReplyToParser { public ReplyToAddresses getRecipientsToReplyTo(Message message, Account account) { Address[] candidateAddress; Address[] replyToAddresses = message.getReplyTo(); Address[] fromAddresses = message.getFrom(); if (replyToAddresses.length > 0) { candidateAddress = replyToAddresses; } else { candidateAddress = fromAddresses; } boolean replyToAddressIsUserIdentity = account.isAnIdentity(candidateAddress); if (replyToAddressIsUserIdentity) { candidateAddress = message.getRecipients(RecipientType.TO); } return new ReplyToAddresses(candidateAddress); }  ReplyToAddresses getRecipientsToReplyTo(Message message, Account account); ReplyToAddresses getRecipientsToReplyListTo(Message message, Account account); ReplyToAddresses getRecipientsToReplyAllTo(Message message, Account account);  }