@@ -18,50 +18,12 @@ public void setup() throws Exception {
1818 email = new Email ();
1919 }
2020
21- @ Test
22- public void testAddRecipient_Basic_Named () {
23- email .
addNamedRecipient (
"name1" ,
TO ,
"[email protected] " );
24- email .
addNamedRecipient (
"name2" ,
CC ,
"[email protected] ,[email protected] " );
25- email .
addNamedRecipient (
"name3" ,
BCC ,
"[email protected] ;[email protected] " );
26- 27-
28- assertThat (email .getRecipients ()).containsExactlyInAnyOrder (
29- new Recipient (
"name1" ,
"[email protected] " ,
TO ),
30- new Recipient (
"name2" ,
"[email protected] " ,
CC ),
31- new Recipient (
"name2" ,
"[email protected] " ,
CC ),
32- new Recipient (
"name3" ,
"[email protected] " ,
BCC ),
33- new Recipient (
"name3" ,
"[email protected] " ,
BCC ),
34- new Recipient (
"name4" ,
"[email protected] " ,
TO ),
35- new Recipient (
"name4" ,
"[email protected] " ,
TO ),
36- new Recipient (
"name4" ,
"[email protected] " ,
TO )
37- );
38- }
39-
40- @ Test
41- public void testAddRecipient_Complex_Named () {
42- email .
addNamedRecipient (
"name1" ,
TO ,
"name1b <[email protected] >" );
43- email .
addNamedRecipient (
"name2" ,
CC ,
"name2b <[email protected] >,[email protected] " );
44- email .
addNamedRecipient (
"name3" ,
BCC ,
"[email protected] ;name3b <[email protected] >" );
45- email .
addNamedRecipient (
"name4" ,
TO ,
"name4b <[email protected] >;name5b <[email protected] >,name6b <[email protected] >" );
46-
47- assertThat (email .getRecipients ()).containsExactlyInAnyOrder (
48- new Recipient (
"name1b" ,
"[email protected] " ,
TO ),
49- new Recipient (
"name2b" ,
"[email protected] " ,
CC ),
50- new Recipient (
"name2" ,
"[email protected] " ,
CC ),
51- new Recipient (
"name3" ,
"[email protected] " ,
BCC ),
52- new Recipient (
"name3b" ,
"[email protected] " ,
BCC ),
53- new Recipient (
"name4b" ,
"[email protected] " ,
TO ),
54- new Recipient (
"name5b" ,
"[email protected] " ,
TO ),
55- new Recipient (
"name6b" ,
"[email protected] " ,
TO )
56- );
57- }
58-
5921 @ Test
6022 public void testAddRecipients_Basic_Named () {
61- email .
addNamedRecipients (
"name1" , TO ,
"[email protected] " );
62- email .
addNamedRecipients (
"name2" , CC ,
"[email protected] ,[email protected] " );
63- email .
addNamedRecipients (
"name3" , BCC ,
"[email protected] ;[email protected] " );
64- 23+ email .
addNamedToRecipients (
"name1" ,
"[email protected] " );
24+ email .
addNamedCcRecipients (
"name2" ,
"[email protected] ,[email protected] " );
25+ email .
addNamedBccRecipients (
"name3" ,
"[email protected] ;[email protected] " );
26+ 6527
6628 assertThat (email .getRecipients ()).containsExactlyInAnyOrder (
6729 new Recipient (
"name1" ,
"[email protected] " ,
TO ),
@@ -77,10 +39,10 @@ public void testAddRecipients_Basic_Named() {
7739
7840 @ Test
7941 public void testAddRecipients_Complex_Named () {
80- email .
addNamedRecipients (
"name1" , TO ,
"name1b <[email protected] >" );
81- email .
addNamedRecipients (
"name2" , CC ,
"name2b <[email protected] >,[email protected] " );
82- email .
addNamedRecipients (
"name3" , BCC ,
"[email protected] ;name3b <[email protected] >" );
83- email .
addNamedRecipients (
"name4" , TO ,
"name4b <[email protected] >;name5b <[email protected] >,name6b <[email protected] >" );
42+ email .
addNamedToRecipients (
"name1" ,
"name1b <[email protected] >" );
43+ email .
addNamedCcRecipients (
"name2" ,
"name2b <[email protected] >,[email protected] " );
44+ email .
addNamedBccRecipients (
"name3" ,
"[email protected] ;name3b <[email protected] >" );
45+ email .
addNamedToRecipients (
"name4" ,
"name4b <[email protected] >;name5b <[email protected] >,name6b <[email protected] >" );
8446
8547 assertThat (email .getRecipients ()).containsExactlyInAnyOrder (
8648 new Recipient (
"name1b" ,
"[email protected] " ,
TO ),
@@ -96,8 +58,8 @@ public void testAddRecipients_Complex_Named() {
9658
9759 @ Test
9860 public void testAddRecipientsVarArgs_Basic_Named () {
99- email .
addNamedRecipients (
"name1" , TO ,
"[email protected] " );
100- email .
addNamedRecipients (
"name2" , CC ,
"[email protected] " ,
"[email protected] " );
61+ email .
addNamedToRecipients (
"name1" ,
"[email protected] " );
62+ email .
addNamedCcRecipients (
"name2" ,
"[email protected] " ,
"[email protected] " );
10163
10264 assertThat (email .getRecipients ()).containsExactlyInAnyOrder (
10365 new Recipient (
"name1" ,
"[email protected] " ,
TO ),
@@ -108,8 +70,8 @@ public void testAddRecipientsVarArgs_Basic_Named() {
10870
10971 @ Test
11072 public void testAddRecipientsVarArgs_Complex_Named () {
111- email .
addNamedRecipients (
"name1" , TO ,
"name1b <[email protected] >" );
112- email .
addNamedRecipients (
"name2" , CC ,
"name2b <[email protected] >" ,
"name3b <[email protected] >" );
73+ email .
addNamedToRecipients (
"name1" ,
"name1b <[email protected] >" );
74+ email .
addNamedCcRecipients (
"name2" ,
"name2b <[email protected] >" ,
"name3b <[email protected] >" );
11375
11476 assertThat (email .getRecipients ()).containsExactlyInAnyOrder (
11577 new Recipient (
"name1b" ,
"[email protected] " ,
TO ),
@@ -120,8 +82,8 @@ public void testAddRecipientsVarArgs_Complex_Named() {
12082
12183 @ Test
12284 public void testAddRecipientsVarArgs_Basic_Nameless () {
123- email .
addRecipients ( TO , "[email protected] " );
124- 85+ email .
addToRecipients ( "[email protected] " );
86+ 12587
12688 assertThat (email .getRecipients ()).containsExactlyInAnyOrder (
12789 new Recipient (
null ,
"[email protected] " ,
TO ),
@@ -132,8 +94,8 @@ public void testAddRecipientsVarArgs_Basic_Nameless() {
13294
13395 @ Test
13496 public void testAddRecipientsVarArgs_Complex_Nameless () {
135- email .
addRecipients ( TO , "name1b <[email protected] >" );
136- email .
addRecipients ( CC , "name2b <[email protected] >" ,
"name3b <[email protected] >" );
97+ email .
addToRecipients ( "name1b <[email protected] >" );
98+ email .
addCcRecipients ( "name2b <[email protected] >" ,
"name3b <[email protected] >" );
13799
138100 assertThat (email .getRecipients ()).containsExactlyInAnyOrder (
139101 new Recipient (
"name1b" ,
"[email protected] " ,
TO ),
@@ -144,10 +106,10 @@ public void testAddRecipientsVarArgs_Complex_Nameless() {
144106
145107 @ Test
146108 public void testAddRecipients_Basic_Nameless () {
147- email .
addRecipients ( TO , "[email protected] " );
148- 149- 150- 109+ email .
addToRecipients ( "[email protected] " );
110+ 111+ 112+ 151113
152114 assertThat (email .getRecipients ()).containsExactlyInAnyOrder (
153115 new Recipient (
null ,
"[email protected] " ,
TO ),
@@ -163,10 +125,10 @@ public void testAddRecipients_Basic_Nameless() {
163125
164126 @ Test
165127 public void testAddRecipients_Complex_Nameless () {
166- email .
addRecipients ( TO , "name1b <[email protected] >" );
167- email .
addRecipients ( CC , "name2b <[email protected] >,[email protected] " );
168- email .
addRecipients ( BCC , "[email protected] ;name3b <[email protected] >" );
169- email .
addRecipients ( TO , "name4b <[email protected] >;name5b <[email protected] >,name6b <[email protected] >" );
128+ email .
addToRecipients ( "name1b <[email protected] >" );
129+ email .
addCcRecipients ( "name2b <[email protected] >,[email protected] " );
130+ email .
addBccRecipients ( "[email protected] ;name3b <[email protected] >" );
131+ email .
addToRecipients ( "name4b <[email protected] >;name5b <[email protected] >,name6b <[email protected] >" );
170132
171133 assertThat (email .getRecipients ()).containsExactlyInAnyOrder (
172134 new Recipient (
"name1b" ,
"[email protected] " ,
TO ),
@@ -183,25 +145,25 @@ public void testAddRecipients_Complex_Nameless() {
183145 @ Test
184146 public void testAddRecipients_Complex_Quicktest () {
185147 // accept valid addresses:
186- email .
addRecipients ( TO , "Abc\\ @[email protected] " );
187- email .
addRecipients ( TO , "Fred\\ [email protected] " );
188- email .
addRecipients ( TO , "Joe.\\ \\ [email protected] " );
189- email .addRecipients ( TO , "\" Abc@def\" @example.com" );
190- email .addRecipients ( TO , "\" Fred Bloggs\" @example.com" );
191- email .
addRecipients ( TO , "customer/[email protected] " );
192- email .
addRecipients ( TO , "[email protected] " );
193- email .
addRecipients ( TO , "!def!xyz%[email protected] " );
194- email .
addRecipients ( TO , "[email protected] " );
195- email .
addRecipients ( TO , "very.“():[]”.VERY.“very@\\ \\ \" very”[email protected] " );
148+ email .
addToRecipients ( "Abc\\ @[email protected] " );
149+ email .
addToRecipients ( "Fred\\ [email protected] " );
150+ email .
addToRecipients ( "Joe.\\ \\ [email protected] " );
151+ email .addToRecipients ( "\" Abc@def\" @example.com" );
152+ email .addToRecipients ( "\" Fred Bloggs\" @example.com" );
153+ email .
addToRecipients ( "customer/[email protected] " );
154+ email .
addToRecipients ( "[email protected] " );
155+ email .
addToRecipients ( "!def!xyz%[email protected] " );
156+ email .
addToRecipients ( "[email protected] " );
157+ email .
addToRecipients ( "very.“():[]”.VERY.“very@\\ \\ \" very”[email protected] " );
196158
197159 // even accept invalid addresses:
198- email .
addRecipients ( TO , "Name <1@[email protected] >" );
160+ email .
addToRecipients ( "Name <1@[email protected] >" );
199161
200162 // OK, InternetAddress#parse() didn't error out on these addresses
201163 }
202164
203165 @ Test
204- public void testAddRecipientByInternetAddress (){
166+ public void testAddRecipientByInternetAddress () {
205167 assertThat (
Email .
interpretRecipientData (
null ,
"[email protected] " ,
null )).
isEqualTo (
new Recipient (
null ,
"[email protected] " ,
null ));
206168 assertThat (
Email .
interpretRecipientData (
null ,
" [email protected] " ,
null )).
isEqualTo (
new Recipient (
null ,
"[email protected] " ,
null ));
207169 assertThat (
Email .
interpretRecipientData (
null ,
" <[email protected] > " ,
null )).
isEqualTo (
new Recipient (
null ,
"[email protected] " ,
null ));
0 commit comments