Skip to content
Permalink
Browse files
Use diamonds.
  • Loading branch information
garydgregory committed Nov 21, 2020
1 parent fa7b811 commit 7ae8c52794709abdb29e6dd4170c125c005e9794
Showing 7 changed files with 41 additions and 41 deletions.
@@ -222,16 +222,16 @@
protected String sslSmtpPort = "465";

/** List of "to" email addresses. */
protected List<InternetAddress> toList = new ArrayList<InternetAddress>();
protected List<InternetAddress> toList = new ArrayList<>();

/** List of "cc" email addresses. */
protected List<InternetAddress> ccList = new ArrayList<InternetAddress>();
protected List<InternetAddress> ccList = new ArrayList<>();

/** List of "bcc" email addresses. */
protected List<InternetAddress> bccList = new ArrayList<InternetAddress>();
protected List<InternetAddress> bccList = new ArrayList<>();

/** List of "replyTo" email addresses. */
protected List<InternetAddress> replyList = new ArrayList<InternetAddress>();
protected List<InternetAddress> replyList = new ArrayList<>();

/**
* Address to which undeliverable mail should be sent.
@@ -248,7 +248,7 @@
* or 2( high ) 3( normal ) 4( low ) and 5( lowest )
* Disposition-Notification-To: user@domain.net
*/
protected Map<String, String> headers = new HashMap<String, String>();
protected Map<String, String> headers = new HashMap<>();

/**
* Used to determine whether to use pop3 before smtp, and if so the settings.
@@ -865,7 +865,7 @@ public Email setTo(final Collection<InternetAddress> aCollection) throws EmailEx
throw new EmailException("Address List provided was invalid");
}

this.toList = new ArrayList<InternetAddress>(aCollection);
this.toList = new ArrayList<>(aCollection);
return this;
}

@@ -974,7 +974,7 @@ public Email setCc(final Collection<InternetAddress> aCollection) throws EmailEx
throw new EmailException("Address List provided was invalid");
}

this.ccList = new ArrayList<InternetAddress>(aCollection);
this.ccList = new ArrayList<>(aCollection);
return this;
}

@@ -1083,7 +1083,7 @@ public Email setBcc(final Collection<InternetAddress> aCollection) throws EmailE
throw new EmailException("Address List provided was invalid");
}

this.bccList = new ArrayList<InternetAddress>(aCollection);
this.bccList = new ArrayList<>(aCollection);
return this;
}

@@ -1162,7 +1162,7 @@ public Email setReplyTo(final Collection<InternetAddress> aCollection) throws Em
throw new EmailException("Address List provided was invalid");
}

this.replyList = new ArrayList<InternetAddress>(aCollection);
this.replyList = new ArrayList<>(aCollection);
return this;
}

@@ -112,7 +112,7 @@ public class HtmlEmail extends MultiPartEmail
* Embedded images Map&lt;String, InlineImage&gt; where the key is the
* user-defined image name.
*/
protected Map<String, InlineImage> inlineEmbeds = new HashMap<String, InlineImage>();
protected Map<String, InlineImage> inlineEmbeds = new HashMap<>();

/**
* Set the text content.
@@ -128,10 +128,10 @@ private String replacePattern(final String htmlMessage, final Pattern pattern)
final StringBuffer stringBuffer = new StringBuffer();

// maps "cid" --> name
final Map<String, String> cidCache = new HashMap<String, String>();
final Map<String, String> cidCache = new HashMap<>();

// maps "name" --> dataSource
final Map<String, DataSource> dataSourceCache = new HashMap<String, DataSource>();
final Map<String, DataSource> dataSourceCache = new HashMap<>();

// in the String, replace all "img src" with a CID and embed the related
// image file if we find it.
@@ -78,8 +78,8 @@
*/
public MimeMessageParser(final MimeMessage message)
{
attachmentList = new ArrayList<DataSource>();
cidMap = new HashMap<String, DataSource>();
attachmentList = new ArrayList<>();
cidMap = new HashMap<>();
this.mimeMessage = message;
this.isMultiPart = false;
}
@@ -329,7 +329,7 @@ public void testImageHtmlEmailRemote() throws Exception
@Test
public void testSendingEmailsInBatch() throws Exception
{
final List<SimpleEmail> emails = new ArrayList<SimpleEmail>();
final List<SimpleEmail> emails = new ArrayList<>();

// we need to instantiate an email to provide the mail session - a bit ugly
final Session session = create(SimpleEmail.class).getMailSession();
@@ -268,7 +268,7 @@ public void testSetFrom() throws Exception
// Test Success
// ====================================================================

final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com", "me@home.com"));
arrExpected.add(
new InternetAddress(
@@ -316,7 +316,7 @@ public void testSetFrom2() throws Exception
// Test Success
// ====================================================================
final String[] testEmailNames = {"Name1", "", null};
final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com", "Name1"));
arrExpected.add(
new InternetAddress(
@@ -350,7 +350,7 @@ public void testAddTo() throws Exception
// Test Success
// ====================================================================

final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -371,7 +371,7 @@ public void testAddToArray() throws Exception
// Test Success
// ====================================================================

final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -393,7 +393,7 @@ public void testAddToWithEncoding() throws Exception
final String testCharset = EmailConstants.ISO_8859_1;
final String[] testEmailNames = {"Name1", "", null};

final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(
new InternetAddress(
"me@home.com",
@@ -422,7 +422,7 @@ public void testAddTo2() throws Exception

final String[] testEmailNames = {"Name1", "", null};

final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com", "Name1"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -450,7 +450,7 @@ public void testSetTo() throws Exception
// ====================================================================
// Test Success
// ====================================================================
final List<InternetAddress> testEmailValid2 = new ArrayList<InternetAddress>();
final List<InternetAddress> testEmailValid2 = new ArrayList<>();
testEmailValid2.add(new InternetAddress("me@home.com", "Name1"));
testEmailValid2.add(
new InternetAddress(
@@ -489,7 +489,7 @@ public void testAddCc() throws Exception
// Test Success
// ====================================================================

final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -510,7 +510,7 @@ public void testAddCcArray() throws Exception
// Test Success
// ====================================================================

final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -532,7 +532,7 @@ public void testAddCcWithEncoding() throws Exception
final String testCharset = EmailConstants.ISO_8859_1;
final String[] testEmailNames = {"Name1", "", null};

final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(
new InternetAddress("me@home.com", "Name1", testCharset));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
@@ -558,7 +558,7 @@ public void testAddCc2() throws Exception

final String[] testEmailNames = {"Name1", "", null};

final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com", "Name1"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -586,7 +586,7 @@ public void testSetCc() throws Exception
// ====================================================================
// Test Success
// ====================================================================
final List<InternetAddress> testEmailValid2 = new ArrayList<InternetAddress>();
final List<InternetAddress> testEmailValid2 = new ArrayList<>();
testEmailValid2.add(new InternetAddress("Name1 <me@home.com>"));
testEmailValid2.add(new InternetAddress("\"joe.doe@apache.org\" <joe.doe@apache.org>"));
testEmailValid2.add(
@@ -615,7 +615,7 @@ public void testAddBcc() throws Exception
// Test Success
// ====================================================================

final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -638,7 +638,7 @@ public void testAddBccArray() throws Exception
// Test Success
// ====================================================================

final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -662,7 +662,7 @@ public void testAddBccWithEncoding() throws Exception
final String testCharset = EmailConstants.ISO_8859_1;
final String[] testEmailNames = {"Name1", "", null};

final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com", "Name1", testCharset));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -690,7 +690,7 @@ public void testAddBcc2() throws Exception
final String[] testEmailNames = {"Name1", "", null};


final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com", "Name1"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -720,7 +720,7 @@ public void testSetBcc() throws Exception
// ====================================================================
// Test Success
// ====================================================================
final List<InternetAddress> testInetEmailValid = new ArrayList<InternetAddress>();
final List<InternetAddress> testInetEmailValid = new ArrayList<>();
testInetEmailValid.add(new InternetAddress("me@home.com", "Name1"));
testInetEmailValid.add(
new InternetAddress(
@@ -754,7 +754,7 @@ public void testAddReplyTo() throws Exception
// Test Success
// ====================================================================

final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -779,7 +779,7 @@ public void testAddReplyToWithEncoding() throws Exception
final String testCharset = EmailConstants.ISO_8859_1;
final String[] testEmailNames = {"Name1", "", null};

final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com", "Name1", testCharset));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -806,7 +806,7 @@ public void testAddReplyTo2() throws Exception

final String[] testEmailNames = {"Name1", "", null};

final List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
final List<InternetAddress> arrExpected = new ArrayList<>();
arrExpected.add(new InternetAddress("me@home.com", "Name1"));
arrExpected.add(new InternetAddress("joe.doe@apache.org"));
arrExpected.add(new InternetAddress("someone_here@work-address.com.au"));
@@ -836,7 +836,7 @@ public void testAddHeader()
// ====================================================================
// Test Success
// ====================================================================
final Map<String, String> headers = new HashMap<String, String>();
final Map<String, String> headers = new HashMap<>();
headers.put("X-Priority", "1");
headers.put("Disposition-Notification-To", "me@home.com");
headers.put("X-Mailer", "Sendmail");
@@ -878,7 +878,7 @@ public void testAddHeaderNullValue() throws Exception
@Test
public void testSetHeaders()
{
final Map<String, String> ht = new Hashtable<String, String>();
final Map<String, String> ht = new Hashtable<>();
ht.put("X-Priority", "1");
ht.put("Disposition-Notification-To", "me@home.com");
ht.put("X-Mailer", "Sendmail");
@@ -892,7 +892,7 @@ public void testSetHeaders()
@Test
public void testGetHeader()
{
final Map<String, String> ht = new Hashtable<String, String>();
final Map<String, String> ht = new Hashtable<>();
ht.put("X-Foo", "Bar");
ht.put("X-Int", "1");

@@ -905,7 +905,7 @@ public void testGetHeader()
@Test
public void testGetHeaders()
{
final Map<String, String> ht = new Hashtable<String, String>();
final Map<String, String> ht = new Hashtable<>();
ht.put("X-Foo", "Bar");
ht.put("X-Int", "1");

@@ -1136,7 +1136,7 @@ public void testGetSetSentDate()
@Test
public void testToInternetAddressArray() throws Exception
{
final List<InternetAddress> testInetEmailValid = new ArrayList<InternetAddress>();
final List<InternetAddress> testInetEmailValid = new ArrayList<>();

testInetEmailValid.add(new InternetAddress("me@home.com", "Name1"));
testInetEmailValid.add(
@@ -138,7 +138,7 @@ public void testSend() throws EmailException, IOException

testEmail.setMsg("Test Message");

final Map<String, String> ht = new HashMap<String, String>();
final Map<String, String> ht = new HashMap<>();
ht.put("X-Priority", "2");
ht.put("Disposition-Notification-To", this.strTestMailFrom);
ht.put("X-Mailer", "Sendmail");

0 comments on commit 7ae8c52

Please sign in to comment.