Skip to content

Commit

Permalink
Merge pull request #203 from croz-ltd/feature_addValidationFailureFlag
Browse files Browse the repository at this point in the history
Add validation failure flag to notifications
  • Loading branch information
jzrilic authored Apr 4, 2024
2 parents 1e11b09 + 5d2001a commit 71e0bc2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,8 @@ public class Notification {
* Timestamp of the notification.
*/
private final Instant timestamp = Instant.now();

public boolean isValidationFailure() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,9 @@ public ValidationFailureNotification(String title, String content, List<String>
super(title, content, messageList, severity, uxNotificationOptions);
this.validationErrorList = validationErrorList;
}

@Override
public boolean isValidationFailure() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ void shouldCreateResponseForValidationFailureForConstraintViolation() {
assertThat(notificationResponse.getNotification()).isNotNull();
assertThat(notificationResponse.getNotification().getSeverity()).isEqualTo(NotificationSeverity.INFO);
assertThat(notificationResponse.getNotification().getContent()).isEqualTo("Validation failed 2");
assertThat(notificationResponse.getNotification().getContent()).isEqualTo("Validation failed 2");
assertThat(notificationResponse.getNotification().isValidationFailure()).isTrue();
}

@Test
Expand All @@ -108,6 +110,7 @@ void shouldCreateResponseForException() {
assertThat(notificationResponse.getNotification()).isNotNull();
assertThat(notificationResponse.getNotification().getSeverity()).isEqualTo(NotificationSeverity.ERROR);
assertThat(notificationResponse.getNotification().getContent()).isEqualTo("Exception");
assertThat(notificationResponse.getNotification().isValidationFailure()).isFalse();
}

@Test
Expand Down

0 comments on commit 71e0bc2

Please sign in to comment.