generated from ministryofjustice/template-repository
-
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.
* PI-2629 PI-2648 PI-2650 --------- Co-authored-by: probation-integration-bot[bot] <177347787+probation-integration-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
72d931d
commit b25fa04
Showing
6 changed files
with
83 additions
and
10 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
projects/justice-email-and-delius/src/dev/resources/messages/successful-long-message.json
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"id": "00000000-0000-0000-0000-000000000000", | ||
"subject": "A000001 was involved in an incident that has a very, very long subject that surpassed the 200 character limit and therefore has been truncated to meet the character limitations for the description in Delius.", | ||
"bodyContent": "Example message", | ||
"fromEmailAddress": "[email protected]", | ||
"receivedDateTime": "2020-01-01T12:34:56Z[Europe/London]" | ||
} |
2 changes: 1 addition & 1 deletion
2
projects/justice-email-and-delius/src/dev/resources/messages/successful-message.json
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"id": "00000000-0000-0000-0000-000000000000", | ||
"subject": "RE: A000001", | ||
"subject": "A000001 was involved in an incident", | ||
"bodyContent": "Example message", | ||
"fromEmailAddress": "[email protected]", | ||
"receivedDateTime": "2020-01-01T12:34:56Z[Europe/London]" | ||
|
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 |
---|---|---|
|
@@ -15,7 +15,7 @@ import org.springframework.boot.test.mock.mockito.MockBean | |
import uk.gov.justice.digital.hmpps.data.generator.Data | ||
import uk.gov.justice.digital.hmpps.entity.Contact | ||
import uk.gov.justice.digital.hmpps.entity.ContactRepository | ||
import uk.gov.justice.digital.hmpps.entity.ContactType.Code.EMAIL_TEXT_FROM_OTHER | ||
import uk.gov.justice.digital.hmpps.entity.ContactType.Code.EMAIL | ||
import uk.gov.justice.digital.hmpps.message.Notification | ||
import uk.gov.justice.digital.hmpps.messaging.EmailMessage | ||
import uk.gov.justice.digital.hmpps.messaging.Handler | ||
|
@@ -41,8 +41,49 @@ internal class IntegrationTest { | |
verify(telemetryService).notificationReceived(notification) | ||
|
||
val contact = verifyContactCreated() | ||
assertThat(contact.type.code, equalTo(EMAIL_TEXT_FROM_OTHER.code)) | ||
assertThat(contact.notes, equalTo("Example message\n")) | ||
assertThat(contact.type.code, equalTo(EMAIL.code)) | ||
assertThat(contact.description, equalTo("Email - was involved in an incident")) | ||
assertThat( | ||
contact.notes, equalTo( | ||
""" | ||
|This contact was created automatically from a forwarded email sent by [email protected] at 12:34 on 01/01/2020. | ||
|Subject: A000001 was involved in an incident | ||
| | ||
|Example message | ||
|""".trimMargin() | ||
) | ||
) | ||
assertThat( | ||
contact.externalReference, | ||
equalTo("urn:uk:gov:hmpps:justice-email:00000000-0000-0000-0000-000000000000") | ||
) | ||
assertThat(contact.staffId, equalTo(Data.STAFF.id)) | ||
assertThat(contact.teamId, equalTo(Data.MANAGER.teamId)) | ||
assertThat(contact.providerId, equalTo(Data.MANAGER.providerId)) | ||
} | ||
|
||
@Test | ||
fun `description is truncated if over 200 chars`() { | ||
val notification = Notification(get<EmailMessage>("successful-long-message")) | ||
handler.handle(notification) | ||
verify(telemetryService).notificationReceived(notification) | ||
|
||
val contact = verifyContactCreated() | ||
assertThat(contact.type.code, equalTo(EMAIL.code)) | ||
assertThat( | ||
contact.description, | ||
equalTo("Email - was involved in an incident that has a very, very long subject that surpassed the 200 character limit and therefore has been truncated to meet the character limitations for the description i ~") | ||
) | ||
assertThat( | ||
contact.notes, equalTo( | ||
""" | ||
|This contact was created automatically from a forwarded email sent by [email protected] at 12:34 on 01/01/2020. | ||
|Subject: A000001 was involved in an incident that has a very, very long subject that surpassed the 200 character limit and therefore has been truncated to meet the character limitations for the description in Delius. | ||
| | ||
|Example message | ||
|""".trimMargin() | ||
) | ||
) | ||
assertThat( | ||
contact.externalReference, | ||
equalTo("urn:uk:gov:hmpps:justice-email:00000000-0000-0000-0000-000000000000") | ||
|
@@ -113,6 +154,9 @@ internal class IntegrationTest { | |
assertThat( | ||
contact.notes, equalTo( | ||
""" | ||
This contact was created automatically from a forwarded email sent by [email protected] at 12:34 on 01/01/2020. | ||
Subject: A000001 was involved in an incident | ||
Paragraph 1 | ||
Paragraph 2 with **bold** text | ||
|
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