Search in sources :

Example 31 with NotificationMessage

use of org.sagebionetworks.bridge.models.notifications.NotificationMessage in project BridgeServer2 by Sage-Bionetworks.

the class SessionValidatorTest method jsonLengthValidation_notificationMessages.

@Test
public void jsonLengthValidation_notificationMessages() {
    Session session = SessionTest.createValidSession();
    NotificationMessage notificationMessage = new NotificationMessage.Builder().withMessage(generateStringOfLength(TEXT_SIZE)).build();
    session.getNotifications().get(0).setMessages(ImmutableList.of(notificationMessage));
    assertValidatorMessage(INSTANCE, session, NOTIFICATIONS_FIELD + "[0].messages", getInvalidStringLengthMessage(TEXT_SIZE));
}
Also used : NotificationMessage(org.sagebionetworks.bridge.models.notifications.NotificationMessage) Session(org.sagebionetworks.bridge.models.schedules2.Session) SessionTest.createValidSession(org.sagebionetworks.bridge.models.schedules2.SessionTest.createValidSession) SessionTest(org.sagebionetworks.bridge.models.schedules2.SessionTest) Test(org.testng.annotations.Test)

Aggregations

NotificationMessage (org.sagebionetworks.bridge.models.notifications.NotificationMessage)31 Test (org.testng.annotations.Test)25 Errors (org.springframework.validation.Errors)12 StatusMessage (org.sagebionetworks.bridge.models.StatusMessage)6 TestUtils.getNotificationMessage (org.sagebionetworks.bridge.TestUtils.getNotificationMessage)4 TestUtils.getNotificationRegistration (org.sagebionetworks.bridge.TestUtils.getNotificationRegistration)3 UserSession (org.sagebionetworks.bridge.models.accounts.UserSession)3 NotificationRegistration (org.sagebionetworks.bridge.models.notifications.NotificationRegistration)3 PostMapping (org.springframework.web.bind.annotation.PostMapping)3 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)3 InvalidParameterException (com.amazonaws.services.sns.model.InvalidParameterException)2 PublishRequest (com.amazonaws.services.sns.model.PublishRequest)2 RequestContext (org.sagebionetworks.bridge.RequestContext)2 App (org.sagebionetworks.bridge.models.apps.App)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 TestUtils.getNotificationTopic (org.sagebionetworks.bridge.TestUtils.getNotificationTopic)1 BadRequestException (org.sagebionetworks.bridge.exceptions.BadRequestException)1 Account (org.sagebionetworks.bridge.models.accounts.Account)1 NotificationTopic (org.sagebionetworks.bridge.models.notifications.NotificationTopic)1 Notification (org.sagebionetworks.bridge.models.schedules2.Notification)1