@@ -35,6 +35,8 @@ public class SendGridTest {
3535
3636 Map correct = new HashMap ();
3737 correct .put ("x-smtpapi" , "{\" to\" :[\" email@example.com\" ,\" email2@example.com\" ]}" );
38+ correct .put ("to[0]" , "email@example.com" );
39+ correct .put ("to[1]" , "email2@example.com" );
3840
3941 assertEquals (correct , email .toWebFormat ());
4042 }
@@ -49,8 +51,8 @@ public class SendGridTest {
4951
5052 Map correct = new HashMap ();
5153 correct .put ("x-smtpapi" , "{\" to\" :[\" email@example.com\" ]}" );
54+ correct .put ("to[0]" , "email@example.com" );
5255 correct .put ("from" , fromaddress );
53- correct .put ("to" , fromaddress );
5456
5557 assertEquals (correct , email .toWebFormat ());
5658
@@ -64,7 +66,6 @@ public class SendGridTest {
6466
6567 Map correct = new HashMap ();
6668 correct .put ("from" , address );
67- correct .put ("to" , address );
6869
6970 assertEquals (correct , email .toWebFormat ());
7071 }
@@ -166,9 +167,9 @@ public class SendGridTest {
166167 assertEquals (correct , email .toWebFormat ());
167168 }
168169
169- @ Test public void testSend () throws FileNotFoundException , SendGridException {
170+ @ Test public void testSend () throws FileNotFoundException , SendGridException , IOException {
170171 email = new SendGrid .Email ();
171- email .addTo ("sendgrid@mailinator.com" );
172+ email .addTo ("sendgrid-to @mailinator.com" );
172173 email .setFrom ("sendgrid-from@mailinator.com" );
173174 email .setFromName ("Mailinator" );
174175 email .setReplyTo ("sendgrid-replyto@mailinator.com" );
@@ -177,7 +178,9 @@ public class SendGridTest {
177178 email .setHtml ("Test body" );
178179 email .addCategory ("-TEST-" );
179180 File file = new File (getClass ().getResource ("/image.png" ).getFile ());
181+ InputStream file2 = new FileInputStream (getClass ().getResource ("/pdf.pdf" ).getFile ());
180182 email .addAttachment ("image.png" , file );
183+ email .addAttachment ("pdf.pdf" , file2 );
181184 SendGrid sendgrid = new SendGrid (USERNAME , PASSWORD );
182185 SendGrid .Response resp = sendgrid .send (email );
183186
0 commit comments