-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new exception for markdown errors.
We probably shouldn't use an exception provided by a dependency for this.
- Loading branch information
1 parent
1bbf8e9
commit 773aab9
Showing
6 changed files
with
55 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
import uk.gov.hmcts.probate.config.properties.registries.Registry; | ||
import uk.gov.hmcts.probate.exception.BadRequestException; | ||
import uk.gov.hmcts.probate.exception.InvalidEmailException; | ||
import uk.gov.hmcts.probate.exception.RequestInformationParameterException; | ||
import uk.gov.hmcts.probate.insights.AppInsights; | ||
import uk.gov.hmcts.probate.model.ApplicationType; | ||
import uk.gov.hmcts.probate.model.CaseType; | ||
|
@@ -2124,7 +2125,7 @@ void verifySendCaveatNocEmail() | |
|
||
@Test | ||
void throwExceptionSendEmailWhenInvalidPersonalisationExists() { | ||
NotificationClientException expectException = assertThrows(NotificationClientException.class, | ||
RequestInformationParameterException expectException = assertThrows(RequestInformationParameterException.class, | ||
() -> notificationService.sendEmail(CASE_STOPPED, markdownLinkCaseData)); | ||
assertEquals(MARKDOWN_ERROR_MESSAGE, expectException.getMessage()); | ||
} | ||
|
@@ -2140,14 +2141,14 @@ void throwExceptionSendExecutorEmailWhenInvalidPersonalisationExists() { | |
.build()) | ||
.email("[email protected]") | ||
.notification("Yes").build(); | ||
NotificationClientException expectException = assertThrows(NotificationClientException.class, | ||
RequestInformationParameterException expectException = assertThrows(RequestInformationParameterException.class, | ||
() -> notificationService.sendEmail(CASE_STOPPED_REQUEST_INFORMATION, markdownLinkCaseData)); | ||
assertEquals(MARKDOWN_ERROR_MESSAGE, expectException.getMessage()); | ||
} | ||
|
||
@Test | ||
void throwExceptionSendCaveatEmailWhenInvalidPersonalisationExists() { | ||
NotificationClientException expectException = assertThrows(NotificationClientException.class, | ||
RequestInformationParameterException expectException = assertThrows(RequestInformationParameterException.class, | ||
() -> notificationService.sendCaveatEmail(GENERAL_CAVEAT_MESSAGE, markdownLinkCaveatData)); | ||
assertEquals(MARKDOWN_ERROR_MESSAGE, expectException.getMessage()); | ||
} | ||
|
@@ -2166,7 +2167,7 @@ void throwExceptionSendEmailWithDocumentAttachedWhenInvalidPersonalisationExists | |
.build()) | ||
.email("[email protected]") | ||
.notification("Yes").build(); | ||
NotificationClientException expectException = assertThrows(NotificationClientException.class, | ||
RequestInformationParameterException expectException = assertThrows(RequestInformationParameterException.class, | ||
() -> notificationService.sendEmailWithDocumentAttached(markdownLinkCaseData, | ||
executorsApplyingNotification, REDECLARATION_SOT)); | ||
assertEquals(MARKDOWN_ERROR_MESSAGE, expectException.getMessage()); | ||
|
10 changes: 10 additions & 0 deletions
10
src/main/java/uk/gov/hmcts/probate/exception/RequestInformationParameterException.java
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,10 @@ | ||
package uk.gov.hmcts.probate.exception; | ||
|
||
public class RequestInformationParameterException extends RuntimeException { | ||
private static final String INVALID_PERSONALISATION_ERROR_MESSAGE = | ||
"Markdown Link detected in case data, stop sending notification email."; | ||
|
||
public RequestInformationParameterException() { | ||
super(INVALID_PERSONALISATION_ERROR_MESSAGE); | ||
} | ||
} |
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