MailAddress implements java.io.Serializable { @Deprecated public static MailAddress getMailSender(String sender) { if (sender == null || sender.trim().length() <= 0) { return null; } if (sender.equals(MailAddress.NULL_SENDER_AS_STRING)) { return MailAddress.nullSender(); } try { return new MailAddress(sender); } catch (AddressException e) { LOGGER.error("Unable to parse the sender address {}, so we fallback to a null sender", sender, e); return MailAddress.nullSender(); } } private  MailAddress();  MailAddress(String address);  MailAddress(String localPart, String domain);  MailAddress(String localPart, Domain domain);  MailAddress(InternetAddress address); static MailAddress nullSender(); @Deprecated static MailAddress getMailSender(String sender); @Deprecated String getHost(); Domain getDomain(); @Deprecated String getUser(); String getLocalPart(); String asString(); @Override String toString(); String asPrettyString(); InternetAddress toInternetAddress(); @Override final boolean equals(Object obj); @Override final int hashCode(); @Deprecated boolean isNullSender(); static final Logger LOGGER; static final long serialVersionUID; static final String NULL_SENDER_AS_STRING; }
@SuppressWarnings("deprecation") @Test void getMailSenderShouldReturnParsedAddressWhenNotNullAddress() throws Exception { assertThat(MailAddress.getMailSender(GOOD_ADDRESS)) .isEqualTo(new MailAddress(GOOD_ADDRESS)); }