Skip to content
Browse files

Implementing Bounce etc

  • Loading branch information...
1 parent b2be4de commit f6c8f1d6cda92b62dd78c9fd58f9ff6e57988ada k-shunji committed
View
97 src/main/java/jp/co/flect/sendgrid/SendGridClient.java
@@ -60,78 +60,105 @@ private void checkResponse(String json) throws SendGridException {
if (map.get("error") != null || map.get("errors") != null) {
throw new SendGridException(map);
}
- if (!"success".equals(map.get("message"))) {
- throw new SendGridException(json);
+ String msg = (String)map.get("message");
+ if (!"success".equals(msg)) {
+ throw new SendGridException(msg == null ? json : msg);
}
}
//Blocks
- public List<Block> getBlocks(Block.Get request) {
- return null;
+ public List<Block> getBlocks(Block.Get request) throws IOException, SendGridException {
+ String json = doRequest("/blocks.get.json", request);
+ List<Map<String, Object>> list = JsonUtils.parseArray(json);
+ List<Block> ret = new ArrayList<Block>();
+ for (Map<String, Object> map : list) {
+ ret.add(new Block(map));
+ }
+ return ret;
}
- public void deleteBlocks(Block.Delete request) {
+ public void deleteBlocks(Block.Delete request) throws IOException, SendGridException {
+ String json = doRequest("/blocks.delete.json", request);
+ checkResponse(json);
}
//Bounce
- public List<Bounce> getBounces(Bounce.Get request) {
- return null;
+ public List<Bounce> getBounces(Bounce.Get request) throws IOException, SendGridException {
+ String json = doRequest("/bounces.get.json", request);
+ List<Map<String, Object>> list = JsonUtils.parseArray(json);
+ List<Bounce> ret = new ArrayList<Bounce>();
+ for (Map<String, Object> map : list) {
+ ret.add(new Bounce(map));
+ }
+ return ret;
+ }
+
+ public void deleteBounces(Bounce.Delete request) throws IOException, SendGridException {
+ String json = doRequest("/bounces.delete.json", request);
+ checkResponse(json);
}
- public void deleteBounces(Bounce.Delete request) {
+ public int countBounces() throws IOException, SendGridException {
+ return countBounces(new Bounce.Count());
}
- public int countBounces(Bounce.Count request) {
- return 0;
+ public int countBounces(Bounce.Count request) throws IOException, SendGridException {
+ String json = doRequest("/bounces.count.json", request);
+ Map<String, Object> map = JsonUtils.parse(json);
+ Double count = (Double)map.get("count");
+ if (count == null) {
+ throw new SendGridException(json);
+ }
+ return count.intValue();
}
//Filter commands
- public List<App> getAvailableApps() {
+ public List<App> getAvailableApps() throws IOException, SendGridException {
return null;
}
- public void activateApp(String name) {
+ public void activateApp(String name) throws IOException, SendGridException {
}
- public void deactivateApp(String name) {
+ public void deactivateApp(String name) throws IOException, SendGridException {
}
- public void setupApp(App app) {
+ public void setupApp(App app) throws IOException, SendGridException {
}
- public App getAppSettings(String name) {
+ public App getAppSettings(String name) throws IOException, SendGridException {
return null;
}
//Individual apps
- public List<String> getAddressWhilteList() {
+ public List<String> getAddressWhilteList() throws IOException, SendGridException {
return null;
}
- public void setAddressWhiteList(List<String> list) {
+ public void setAddressWhiteList(List<String> list) throws IOException, SendGridException {
}
- public String getBcc() {
+ public String getBcc() throws IOException, SendGridException {
return null;
}
- public void setBcc(String bcc) {
+ public void setBcc(String bcc) throws IOException, SendGridException {
}
- public boolean isEnableClickTrackingInPlainText() {
+ public boolean isEnableClickTrackingInPlainText() throws IOException, SendGridException {
return false;
}
- public void setEnableClickTrackingInPlainText(boolean b) {
+ public void setEnableClickTrackingInPlainText(boolean b) throws IOException, SendGridException {
}
- public void setDomainKeys(String domain, boolean sender) {
+ public void setDomainKeys(String domain, boolean sender) throws IOException, SendGridException {
}
- public void setDKIM(String domain, boolean useFrom) {
+ public void setDKIM(String domain, boolean useFrom) throws IOException, SendGridException {
}
- public void setEventNotification(String url, List<Event> enableEvents) {
+ public void setEventNotification(String url, List<Event> enableEvents) throws IOException, SendGridException {
}
//InvalidEmails
@@ -145,7 +172,7 @@ public void setEventNotification(String url, List<Event> enableEvents) {
return ret;
}
- public void deleteInvalidEmails(InvalidEmail.Delete request) {
+ public void deleteInvalidEmails(InvalidEmail.Delete request) throws IOException, SendGridException {
}
//Mail
@@ -171,28 +198,28 @@ public void mail(WebMail mail, File... attachements) throws IOException, SendGri
//Parse WebHook Settings - NOT IMPLEMENTED
//Profile
- public Profile getProfile() {
+ public Profile getProfile() throws IOException, SendGridException {
return null;
}
- public void setProfile(Profile profile) {
+ public void setProfile(Profile profile) throws IOException, SendGridException {
}
- public void setPassword(String newPassword) {
+ public void setPassword(String newPassword) throws IOException, SendGridException {
}
- public void setUsername(String newUsername) {
+ public void setUsername(String newUsername) throws IOException, SendGridException {
}
- public void setEmail(String newEmail) {
+ public void setEmail(String newEmail) throws IOException, SendGridException {
}
//SpamReports
- public List<SpamReport> getSpamReports(SpamReport.Get request) {
+ public List<SpamReport> getSpamReports(SpamReport.Get request) throws IOException, SendGridException {
return null;
}
- public void deleteSpamReports(SpamReport.Delete request) {
+ public void deleteSpamReports(SpamReport.Delete request) throws IOException, SendGridException {
}
//Statistics
@@ -219,13 +246,13 @@ public void deleteSpamReports(SpamReport.Delete request) {
}
//Unsubscribles
- public List<Unsubscribe> getUnsubscribes(Unsubscribe.Get request) {
+ public List<Unsubscribe> getUnsubscribes(Unsubscribe.Get request) throws IOException, SendGridException {
return null;
}
- public void deleteUnsubscribes(Unsubscribe.Delete request) {
+ public void deleteUnsubscribes(Unsubscribe.Delete request) throws IOException, SendGridException {
}
- public void addUnsubscribes(Unsubscribe.Add request) {
+ public void addUnsubscribes(Unsubscribe.Add request) throws IOException, SendGridException {
}
}
View
14 src/main/java/jp/co/flect/sendgrid/model/AbstractGetRequest.java
@@ -16,8 +16,18 @@ protected AbstractGetRequest(boolean includeDateParameter) {
public Date getStartDate() { return doGetDate("start_date");}
public Date getEndDate() { return doGetDate("end_date");}
public void setStartAndEndDate(Date start, Date end) {
- doSetDate("start_date", start);
- doSetDate("end_date", end);
+ if (start == null && end == null) {
+ throw new IllegalArgumentException();
+ }
+ if (start != null && end != null && start.getTime() > end.getTime()) {
+ throw new IllegalArgumentException("Start date must be before the end date");
+ }
+ if (start != null) {
+ doSetDate("start_date", start);
+ }
+ if (end != null) {
+ doSetDate("end_date", end);
+ }
}
}
View
21 src/main/java/jp/co/flect/sendgrid/model/Block.java
@@ -1,12 +1,25 @@
package jp.co.flect.sendgrid.model;
-public class Block {
+import java.util.Date;
+import java.util.Map;
+
+public class Block extends AbstractModel {
- public static class Get {
-
+ public Block(Map<String, Object> map) {
+ super(map);
}
+ public String getStatus() { return doGetString("status");}
+ public String getReason() { return doGetString("reason");}
+ public Date getCreated() { return doGetDate("created", true);}
+ public String getEmail() { return doGetString("email");}
- public static class Delete {
+ public static class Get extends BasicGetRequest {
+ }
+
+ public static class Delete extends AbstractRequest {
+
+ public String getEmail() { return doGetString("email");}
+ public void setEmail(String s) { doSetString("email", s);}
}
}
View
64 src/main/java/jp/co/flect/sendgrid/model/Bounce.java
@@ -1,15 +1,71 @@
package jp.co.flect.sendgrid.model;
-public class Bounce {
+import java.util.Date;
+import java.util.Map;
+
+public class Bounce extends AbstractModel {
+
+ public enum Type {
+ HARD,
+ SOFT
+ }
- public static class Get {
+ public Bounce(Map<String, Object> map) {
+ super(map);
+ }
+
+ public String getStatus() { return doGetString("status");}
+ public String getReason() { return doGetString("reason");}
+ public Date getCreated() { return doGetDate("created", true);}
+ public String getEmail() { return doGetString("email");}
+
+ public static class Get extends BasicGetRequest {
+
+ public Bounce.Type getType() {
+ String s = doGetString("type");
+ return s == null ? null : Type.valueOf(s.toUpperCase());
+ }
+ public void setType(Bounce.Type type) {
+ doSetString("type", type.toString().toLowerCase());
+ }
}
- public static class Delete {
+ public static class Count extends AbstractRequest {
+
+ public Date getStartDate() { return doGetDate("start_date");}
+ public Date getEndDate() { return doGetDate("end_date");}
+ public void setStartAndEndDate(Date start, Date end) {
+ if (start == null && end == null) {
+ throw new IllegalArgumentException();
+ }
+ if (start != null && end != null && start.getTime() > end.getTime()) {
+ throw new IllegalArgumentException("Start date must be before the end date");
+ }
+ if (start != null) {
+ doSetDate("start_date", start);
+ }
+ if (end != null) {
+ doSetDate("end_date", end);
+ }
+ }
+
+
+ public Bounce.Type getType() {
+ String s = doGetString("type");
+ return s == null ? null : Type.valueOf(s.toUpperCase());
+ }
+
+ public void setType(Bounce.Type type) {
+ doSetString("type", type.toString().toLowerCase());
+ }
+
}
- public static class Count {
+ public static class Delete extends Count {
+
+ public String getEmail() { return doGetString("email");}
+ public void setEmail(String s) { doSetString("email", s);}
}
}
View
51 src/test/java/jp/co/flect/sendgrid/BlockTest.java
@@ -0,0 +1,51 @@
+package jp.co.flect.sendgrid;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+import org.junit.Test;
+import org.junit.BeforeClass;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Properties;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Date;
+import java.util.Map;
+import java.util.HashMap;
+
+import jp.co.flect.sendgrid.model.Block;
+
+import static jp.co.flect.sendgrid.SendGridTest.USERNAME;
+import static jp.co.flect.sendgrid.SendGridTest.PASSWORD;
+import static jp.co.flect.sendgrid.SendGridTest.MAIL_FROM;
+import static jp.co.flect.sendgrid.SendGridTest.MAIL_TO;
+
+public class BlockTest {
+
+ @Test
+ public void invalidMails() throws Exception {
+ SendGridClient client = new SendGridClient(USERNAME, PASSWORD);
+ Block.Get request = new Block.Get();
+ List<Block> list = client.getBlocks(request);
+ assertTrue(list.size() == 0);
+ }
+
+ @Test
+ public void delete() throws Exception {
+ SendGridClient client = new SendGridClient(USERNAME, PASSWORD);
+ Block.Delete request = new Block.Delete();
+ request.setEmail("hoge@flect.co.jp");
+
+ try {
+ client.deleteBlocks(request);
+ fail();
+ } catch (SendGridException e) {
+ }
+ }
+
+}
View
80 src/test/java/jp/co/flect/sendgrid/BounceTest.java
@@ -0,0 +1,80 @@
+package jp.co.flect.sendgrid;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+import org.junit.Test;
+import org.junit.BeforeClass;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Properties;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Date;
+import java.util.Map;
+import java.util.HashMap;
+
+import jp.co.flect.sendgrid.model.Bounce;
+import jp.co.flect.sendgrid.model.WebMail;
+
+import static jp.co.flect.sendgrid.SendGridTest.USERNAME;
+import static jp.co.flect.sendgrid.SendGridTest.PASSWORD;
+import static jp.co.flect.sendgrid.SendGridTest.MAIL_FROM;
+import static jp.co.flect.sendgrid.SendGridTest.MAIL_TO;
+import static jp.co.flect.sendgrid.SendGridTest.BOUNCE_FROM;
+import static jp.co.flect.sendgrid.SendGridTest.BOUNCE_TO;
+
+public class BounceTest {
+
+ public static WebMail createBounceMail() {
+ WebMail mail = new WebMail();
+ mail.setFrom(BOUNCE_FROM);
+ mail.setTo(BOUNCE_TO);
+ mail.setSubject("Bounce Test");
+ mail.setText("test");
+ return mail;
+ }
+
+ @Test
+ public void test() throws Exception {
+ SendGridClient client = new SendGridClient(USERNAME, PASSWORD);
+
+ WebMail mail = createBounceMail();
+ client.mail(mail);
+
+ int count = 0;
+ int tryCount = 30;
+ while (tryCount > 0) {
+ count = client.countBounces();
+ if (count == 0) {
+ tryCount--;
+ if (tryCount == 0) {
+ fail();
+ }
+ Thread.sleep(3000);
+ } else {
+ break;
+ }
+ }
+
+ Bounce.Get request = new Bounce.Get();
+ boolean bThere = false;
+ List<Bounce> list = client.getBounces(request);
+ assertEquals(count, list.size());
+ for (Bounce b : list) {
+ if (b.getEmail().equals(BOUNCE_TO)) {
+ bThere = true;
+ }
+ }
+ assertTrue(bThere);
+
+ Bounce.Delete request2 = new Bounce.Delete();
+ request2.setEmail(mail.getTo());
+ client.deleteBounces(request2);
+ }
+
+}
View
56 src/test/java/jp/co/flect/sendgrid/InvalidEmailTest.java
@@ -0,0 +1,56 @@
+package jp.co.flect.sendgrid;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+import org.junit.Test;
+import org.junit.BeforeClass;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Properties;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Date;
+import java.util.Map;
+import java.util.HashMap;
+
+import jp.co.flect.sendgrid.model.InvalidEmail;
+
+import static jp.co.flect.sendgrid.SendGridTest.USERNAME;
+import static jp.co.flect.sendgrid.SendGridTest.PASSWORD;
+import static jp.co.flect.sendgrid.SendGridTest.MAIL_FROM;
+import static jp.co.flect.sendgrid.SendGridTest.MAIL_TO;
+
+public class InvalidEmailTest {
+
+ @Test
+ public void invalidMails() throws Exception {
+ SendGridClient client = new SendGridClient(USERNAME, PASSWORD);
+ InvalidEmail.Get request = new InvalidEmail.Get();
+ List<InvalidEmail> list = client.getInvalidEmails(request);
+ assertTrue(list.size() > 0);
+ for (InvalidEmail mail : list) {
+ System.out.println("InvalidEmail: " + mail.getEmail() + ", " + mail.getCreated() + ", " + mail.getReason());
+ }
+ }
+
+ @Test
+ public void limitError() throws Exception {
+ SendGridClient client = new SendGridClient(USERNAME, PASSWORD);
+ InvalidEmail.Get request = new InvalidEmail.Get();
+ request.setLimit(0);
+ try {
+ client.getInvalidEmails(request);
+ fail();
+ } catch (SendGridException e) {
+ System.out.println("limitError:" + e.getMessage());
+ System.out.println("limitError2:" + e.getAllMessages());
+ assertTrue(e.getMessage().indexOf("Limit") > 0);
+ }
+ }
+
+}
View
12 src/test/java/jp/co/flect/sendgrid/MailSendTest.java
@@ -21,13 +21,13 @@
import jp.co.flect.sendgrid.model.InvalidEmail;
import jp.co.flect.sendgrid.model.WebMail;
+import static jp.co.flect.sendgrid.SendGridTest.USERNAME;
+import static jp.co.flect.sendgrid.SendGridTest.PASSWORD;
+import static jp.co.flect.sendgrid.SendGridTest.MAIL_FROM;
+import static jp.co.flect.sendgrid.SendGridTest.MAIL_TO;
+
public class MailSendTest {
- private static final String USERNAME = SendGridTest.USERNAME;
- private static final String PASSWORD = SendGridTest.PASSWORD;
- private static final String MAIL_FROM = SendGridTest.MAIL_FROM;
- private static final String MAIL_TO = SendGridTest.MAIL_TO;
-
@Test
public void sendMail() throws Exception {
Date now = new Date();
@@ -67,7 +67,7 @@ public void attachement() throws Exception {
mail.setText("添付ファイルテスト\nてすと\n\u2650\u2764\u270f\u2708" + new String(Character.toChars(0x1F419)));
File f1 = new File("testdata/test.zip");
- File f2 = new File("testdata/日本語.txt");
+ File f2 = new File("testdata/test.txt");
client.mail(mail, f1, f2);
}
View
94 src/test/java/jp/co/flect/sendgrid/SendGridTest.java
@@ -12,15 +12,8 @@
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;
-import java.util.Arrays;
-import java.util.List;
import java.util.Date;
-import java.util.Map;
-import java.util.HashMap;
-
-import jp.co.flect.sendgrid.model.InvalidEmail;
-import jp.co.flect.sendgrid.model.Statistic;
-import jp.co.flect.sendgrid.model.WebMail;
+import java.util.Calendar;
public class SendGridTest {
@@ -28,6 +21,8 @@
public static String PASSWORD;
public static String MAIL_FROM;
public static String MAIL_TO;
+ public static String BOUNCE_FROM;
+ public static String BOUNCE_TO;
static {
try {
@@ -43,86 +38,27 @@
PASSWORD = props.getProperty("SENDGRID_PASSWORD");
MAIL_FROM = props.getProperty("MAIL_FROM");
MAIL_TO = props.getProperty("MAIL_TO");
+ BOUNCE_FROM = props.getProperty("BOUNCE_FROM");
+ BOUNCE_TO = props.getProperty("BOUNCE_TO");
assertNotNull(USERNAME);
assertNotNull(PASSWORD);
assertNotNull(MAIL_FROM);
assertNotNull(MAIL_TO);
+ assertNotNull(BOUNCE_FROM);
+ assertNotNull(BOUNCE_TO);
} catch (Exception e) {
e.printStackTrace();
}
}
- @Test
- public void invalidMails() throws Exception {
- SendGridClient client = new SendGridClient(USERNAME, PASSWORD);
- InvalidEmail.Get request = new InvalidEmail.Get();
- List<InvalidEmail> list = client.getInvalidEmails(request);
- assertTrue(list.size() > 0);
- for (InvalidEmail mail : list) {
- System.out.println("InvalidEmail: " + mail.getEmail() + ", " + mail.getCreated() + ", " + mail.getReason());
- }
- }
-
- @Test
- public void limitError() throws Exception {
- SendGridClient client = new SendGridClient(USERNAME, PASSWORD);
- InvalidEmail.Get request = new InvalidEmail.Get();
- request.setLimit(0);
- try {
- client.getInvalidEmails(request);
- fail();
- } catch (SendGridException e) {
- System.out.println("limitError:" + e.getMessage());
- System.out.println("limitError2:" + e.getAllMessages());
- assertTrue(e.getMessage().indexOf("Limit") > 0);
- }
- }
-
- @Test
- public void statistics() throws Exception {
- SendGridClient client = new SendGridClient(USERNAME, PASSWORD);
- Statistic.Get request = new Statistic.Get();
- //request.setCategory("test");
- request.setDays(10);
- List<Statistic> list = client.getStatistics(request);
- assertTrue(list.size() > 0);
- for (Statistic stat : list) {
- System.out.println("Statistics: " +
- stat.getDate() + ", " +
- "Category = " + stat.getCategory() + ", " +
- "Requests = " + stat.getRequests() + ", " +
- "Bounces = " + stat.getBounces() + ", " +
- "Clicks = " + stat.getClicks() + ", " +
- "Opens = " + stat.getOpens() + ", " +
- "SpamReports = " + stat.getSpamReports() + ", " +
- "UniqueClicks = " + stat.getUniqueClicks() + ", " +
- "UniqueOpens = " + stat.getUniqueOpens() + ", " +
- "Blocked = " + stat.getBlocked() + ", " +
- "Delivered = " + stat.getDelivered() + ", " +
- "Unsubscribes = " + stat.getUnsubscribes() + ", " +
- "InvalidEmails = " + stat.getInvalidEmails() + ", " +
- "RepeatUnsubscribes = " + stat.getRepeatUnsubscribes() + ", " +
- "SpamDrops = " + stat.getSpamDrops() + ", " +
- "RepeatBounces = " + stat.getRepeatBounces() + ", " +
- "RepeatSpamReports = " + stat.getRepeatSpamReports() + ", " +
- "");
- }
+ public static Date getDateBefore(int days) {
+ Calendar cal = Calendar.getInstance();
+ cal.add(0 - days, Calendar.DATE);
+ cal.set(Calendar.HOUR_OF_DAY, 0);
+ cal.set(Calendar.MINUTE, 0);
+ cal.set(Calendar.SECOND, 0);
+ cal.set(Calendar.MILLISECOND, 0);
+ return cal.getTime();
}
-
- @Test
- public void categoryList() throws Exception {
- SendGridClient client = new SendGridClient(USERNAME, PASSWORD);
- List<String> list = client.getCategoryList();
- assertTrue(list.size() > 0);
-
- boolean bTest = false;
- for (String s : list) {
- if (s.equals("test")) {
- bTest = true;
- }
- }
- assertTrue(bTest);
- }
-
}
View
76 src/test/java/jp/co/flect/sendgrid/StatisticTest.java
@@ -0,0 +1,76 @@
+package jp.co.flect.sendgrid;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+import org.junit.Test;
+import org.junit.BeforeClass;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Properties;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Date;
+import java.util.Map;
+import java.util.HashMap;
+
+import jp.co.flect.sendgrid.model.Statistic;
+
+import static jp.co.flect.sendgrid.SendGridTest.USERNAME;
+import static jp.co.flect.sendgrid.SendGridTest.PASSWORD;
+import static jp.co.flect.sendgrid.SendGridTest.MAIL_FROM;
+import static jp.co.flect.sendgrid.SendGridTest.MAIL_TO;
+
+public class StatisticTest {
+
+ @Test
+ public void statistics() throws Exception {
+ SendGridClient client = new SendGridClient(USERNAME, PASSWORD);
+ Statistic.Get request = new Statistic.Get();
+ //request.setCategory("test");
+ request.setDays(10);
+ List<Statistic> list = client.getStatistics(request);
+ assertTrue(list.size() > 0);
+ for (Statistic stat : list) {
+ System.out.println("Statistics: " +
+ stat.getDate() + ", " +
+ "Category = " + stat.getCategory() + ", " +
+ "Requests = " + stat.getRequests() + ", " +
+ "Bounces = " + stat.getBounces() + ", " +
+ "Clicks = " + stat.getClicks() + ", " +
+ "Opens = " + stat.getOpens() + ", " +
+ "SpamReports = " + stat.getSpamReports() + ", " +
+ "UniqueClicks = " + stat.getUniqueClicks() + ", " +
+ "UniqueOpens = " + stat.getUniqueOpens() + ", " +
+ "Blocked = " + stat.getBlocked() + ", " +
+ "Delivered = " + stat.getDelivered() + ", " +
+ "Unsubscribes = " + stat.getUnsubscribes() + ", " +
+ "InvalidEmails = " + stat.getInvalidEmails() + ", " +
+ "RepeatUnsubscribes = " + stat.getRepeatUnsubscribes() + ", " +
+ "SpamDrops = " + stat.getSpamDrops() + ", " +
+ "RepeatBounces = " + stat.getRepeatBounces() + ", " +
+ "RepeatSpamReports = " + stat.getRepeatSpamReports() + ", " +
+ "");
+ }
+ }
+
+ @Test
+ public void categoryList() throws Exception {
+ SendGridClient client = new SendGridClient(USERNAME, PASSWORD);
+ List<String> list = client.getCategoryList();
+ assertTrue(list.size() > 0);
+
+ boolean bTest = false;
+ for (String s : list) {
+ if (s.equals("test")) {
+ bTest = true;
+ }
+ }
+ assertTrue(bTest);
+ }
+
+}
View
0 testdata/���{��.txt → testdata/test.txt
File renamed without changes.

0 comments on commit f6c8f1d

Please sign in to comment.
Something went wrong with that request. Please try again.