-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b39722
commit a4baed6
Showing
7 changed files
with
102 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,10 +17,11 @@ class DeserializationServiceTest { | |
|
||
@Test | ||
void readDeliveryNotification() throws IOException { | ||
String notification = "" | ||
+ "{" | ||
+ "\"notificationType\": \"Delivery\"" | ||
+ "}"; | ||
String notification = """ | ||
{ | ||
"notificationType": "Delivery" | ||
} | ||
"""; | ||
|
||
final SesMessage sesMessage = deserializationService.readSesMessage(notification); | ||
|
||
|
@@ -29,10 +30,12 @@ void readDeliveryNotification() throws IOException { | |
|
||
@Test | ||
void readDeliveryEvent() throws IOException { | ||
String notification = "" | ||
+ "{" | ||
+ "\"eventType\": \"Delivery\"" | ||
+ "}"; | ||
String notification = """ | ||
{ | ||
"eventType": "Delivery" | ||
} | ||
"""; | ||
|
||
|
||
final SesMessage sesMessage = deserializationService.readSesMessage(notification); | ||
|
||
|
@@ -41,10 +44,11 @@ void readDeliveryEvent() throws IOException { | |
|
||
@Test | ||
void readBounceNotification() throws IOException { | ||
String notification = "" | ||
+ "{" | ||
+ "\"notificationType\": \"Bounce\"" | ||
+ "}"; | ||
String notification = """ | ||
{ | ||
"notificationType": "Bounce" | ||
} | ||
"""; | ||
|
||
final SesMessage sesMessage = deserializationService.readSesMessage(notification); | ||
|
||
|
@@ -53,84 +57,86 @@ void readBounceNotification() throws IOException { | |
|
||
@Test | ||
void readBounceEvent() throws IOException { | ||
String notification = "{\n" + | ||
" \"eventType\": \"Bounce\",\n" + | ||
" \"bounce\": {\n" + | ||
" \"feedbackId\": \"0100017f5acb69b0-6c754b6c-3cfd-423f-8d91-2cc01b3d7f75-000000\",\n" + | ||
" \"bounceType\": \"Permanent\",\n" + | ||
" \"bounceSubType\": \"General\",\n" + | ||
" \"bouncedRecipients\": [\n" + | ||
" {\n" + | ||
" \"emailAddress\": \"[email protected]\",\n" + | ||
" \"action\": \"failed\",\n" + | ||
" \"status\": \"5.1.1\",\n" + | ||
" \"diagnosticCode\": \"smtp; 550 5.1.1 user unknown\"\n" + | ||
" }\n" + | ||
" ],\n" + | ||
" \"timestamp\": \"2022-03-05T15:55:54.762Z\",\n" + | ||
" \"reportingMTA\": \"dns; a8-62.smtp-out.amazonses.com\"\n" + | ||
" },\n" + | ||
" \"mail\": {\n" + | ||
" \"timestamp\": \"2022-03-05T15:55:53.969Z\",\n" + | ||
" \"source\": \"[email protected]\",\n" + | ||
" \"sourceArn\": \"arn:aws:ses:us-east-1:844875565510:identity/gresb.com\",\n" + | ||
" \"sendingAccountId\": \"844875565510\",\n" + | ||
" \"messageId\": \"0100017f5acb66f1-e509f90c-9c19-4dd6-ae93-bb7a0f7ea93c-000000\",\n" + | ||
" \"destination\": [\n" + | ||
" \"[email protected]\"\n" + | ||
" ],\n" + | ||
" \"headersTruncated\": false,\n" + | ||
" \"headers\": [\n" + | ||
" {\n" + | ||
" \"name\": \"From\",\n" + | ||
" \"value\": \"[email protected]\"\n" + | ||
" },\n" + | ||
" {\n" + | ||
" \"name\": \"To\",\n" + | ||
" \"value\": \"[email protected]\"\n" + | ||
" },\n" + | ||
" {\n" + | ||
" \"name\": \"Subject\",\n" + | ||
" \"value\": \"dafasdf\"\n" + | ||
" },\n" + | ||
" {\n" + | ||
" \"name\": \"MIME-Version\",\n" + | ||
" \"value\": \"1.0\"\n" + | ||
" },\n" + | ||
" {\n" + | ||
" \"name\": \"Content-Type\",\n" + | ||
" \"value\": \"multipart/alternative; boundary=\\\"----=_Part_1237092_28065239.1646495753972\\\"\"\n" + | ||
" }\n" + | ||
" ],\n" + | ||
" \"commonHeaders\": {\n" + | ||
" \"from\": [\n" + | ||
" \"[email protected]\"\n" + | ||
" ],\n" + | ||
" \"to\": [\n" + | ||
" \"[email protected]\"\n" + | ||
" ],\n" + | ||
" \"messageId\": \"0100017f5acb66f1-e509f90c-9c19-4dd6-ae93-bb7a0f7ea93c-000000\",\n" + | ||
" \"subject\": \"dafasdf\"\n" + | ||
" },\n" + | ||
" \"tags\": {\n" + | ||
" \"ses:operation\": [\n" + | ||
" \"SendEmail\"\n" + | ||
" ],\n" + | ||
" \"ses:configuration-set\": [\n" + | ||
" \"gresb-ses-config\"\n" + | ||
" ],\n" + | ||
" \"ses:source-ip\": [\n" + | ||
" \"45.95.65.150\"\n" + | ||
" ],\n" + | ||
" \"ses:from-domain\": [\n" + | ||
" \"gresb.com\"\n" + | ||
" ],\n" + | ||
" \"ses:caller-identity\": [\n" + | ||
" \"gresb-root-developer-break-glass\"\n" + | ||
" ]\n" + | ||
" }\n" + | ||
" }\n" + | ||
"}"; | ||
String notification = """ | ||
{ | ||
"eventType": "Bounce", | ||
"bounce": { | ||
"feedbackId": "0100017f5acb69b0-6c754b6c-3cfd-423f-8d91-2cc01b3d7f75-000000", | ||
"bounceType": "Permanent", | ||
"bounceSubType": "General", | ||
"bouncedRecipients": [ | ||
{ | ||
"emailAddress": "[email protected]", | ||
"action": "failed", | ||
"status": "5.1.1", | ||
"diagnosticCode": "smtp; 550 5.1.1 user unknown" | ||
} | ||
], | ||
"timestamp": "2022-03-05T15:55:54.762Z", | ||
"reportingMTA": "dns; a8-62.smtp-out.amazonses.com" | ||
}, | ||
"mail": { | ||
"timestamp": "2022-03-05T15:55:53.969Z", | ||
"source": "[email protected]", | ||
"sourceArn": "arn:aws:ses:us-east-1:844875565510:identity/gresb.com", | ||
"sendingAccountId": "844875565510", | ||
"messageId": "0100017f5acb66f1-e509f90c-9c19-4dd6-ae93-bb7a0f7ea93c-000000", | ||
"destination": [ | ||
"[email protected]" | ||
], | ||
"headersTruncated": false, | ||
"headers": [ | ||
{ | ||
"name": "From", | ||
"value": "[email protected]" | ||
}, | ||
{ | ||
"name": "To", | ||
"value": "[email protected]" | ||
}, | ||
{ | ||
"name": "Subject", | ||
"value": "dafasdf" | ||
}, | ||
{ | ||
"name": "MIME-Version", | ||
"value": "1.0" | ||
}, | ||
{ | ||
"name": "Content-Type", | ||
"value": "multipart/alternative; boundary=\\"----=_Part_1237092_28065239.1646495753972\\"" | ||
} | ||
], | ||
"commonHeaders": { | ||
"from": [ | ||
"[email protected]" | ||
], | ||
"to": [ | ||
"[email protected]" | ||
], | ||
"messageId": "0100017f5acb66f1-e509f90c-9c19-4dd6-ae93-bb7a0f7ea93c-000000", | ||
"subject": "dafasdf" | ||
}, | ||
"tags": { | ||
"ses:operation": [ | ||
"SendEmail" | ||
], | ||
"ses:configuration-set": [ | ||
"gresb-ses-config" | ||
], | ||
"ses:source-ip": [ | ||
"45.95.65.150" | ||
], | ||
"ses:from-domain": [ | ||
"gresb.com" | ||
], | ||
"ses:caller-identity": [ | ||
"gresb-root-developer-break-glass" | ||
] | ||
} | ||
} | ||
} | ||
"""; | ||
|
||
final SesMessage sesMessage = deserializationService.readSesMessage(notification); | ||
|
||
|
@@ -139,10 +145,11 @@ void readBounceEvent() throws IOException { | |
|
||
@Test | ||
void readComplaintNotification() throws IOException { | ||
String notification = "" | ||
+ "{" | ||
+ "\"notificationType\": \"Complaint\"" | ||
+ "}"; | ||
String notification = """ | ||
{ | ||
"notificationType": "Complaint" | ||
} | ||
"""; | ||
|
||
final SesMessage sesMessage = deserializationService.readSesMessage(notification); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,6 @@ public class TestDataFactory { | |
public static final String TEST_1_EMAIL_COM = "[email protected]"; | ||
public static final String TEST_1_EMAIL_COM_WITH_NAME = String.format("Test 1 <%s>", TEST_1_EMAIL_COM); | ||
public static final String TEST_2_EMAIL_COM = "[email protected]"; | ||
public static final String TEST_2_EMAIL_COM_WITH_NAME = String.format("Test 2 <%s>", TEST_2_EMAIL_COM); | ||
public static final String TEST_SUBJECT = "Test subject"; | ||
public static final String FROM_1_EMAIL_COM = "[email protected]"; | ||
public static final String FROM_2_EMAIL_COM = "[email protected]"; | ||
|