1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.ken.services.impl;
17
18 import org.junit.Test;
19 import org.kuali.rice.ken.bo.Notification;
20 import org.kuali.rice.ken.bo.NotificationMessageDelivery;
21 import org.kuali.rice.ken.service.NotificationMessageDeliveryService;
22 import org.kuali.rice.ken.test.KENTestCase;
23 import org.kuali.rice.ken.test.TestConstants;
24
25 import java.util.Collection;
26
27 import static org.junit.Assert.*;
28
29
30
31
32
33 public class NotificationMessageDeliveryServiceImplTest extends KENTestCase {
34
35 @Test
36 public void testGetNotificationMessageDelivery_validId() {
37 NotificationMessageDeliveryService nSvc = services.getNotificationMessageDeliveryService();
38
39 NotificationMessageDelivery nmd = nSvc.getNotificationMessageDelivery(TestConstants.VALID_MESSAGE_DELIVERY_ID);
40
41 assertNotNull(nmd.getMessageDeliveryStatus());
42 }
43
44 @Test
45 public void testGetNotification_nonExistentNotification() {
46 NotificationMessageDeliveryService nSvc = services.getNotificationMessageDeliveryService();
47
48 NotificationMessageDelivery nmd = nSvc.getNotificationMessageDelivery(TestConstants.NON_EXISTENT_ID);
49
50 assertNull(nmd);
51 }
52
53 @Test
54 public void testGetAllNotificationMessageDeliveries() {
55 NotificationMessageDeliveryService nSvc = services.getNotificationMessageDeliveryService();
56 Collection<NotificationMessageDelivery> deliveries = nSvc.getNotificationMessageDeliveries();
57 assertNotNull(deliveries);
58 assertEquals(TestConstants.NUM_OF_MSG_DELIVS_IN_TEST_DATA, deliveries.size());
59 }
60
61 @Test
62 public void testGetSpecificNotificationMessageDeliveries() {
63 Notification n = services.getNotificationService().getNotification(TestConstants.NOTIFICATION_1);
64 NotificationMessageDeliveryService nSvc = services.getNotificationMessageDeliveryService();
65 Collection<NotificationMessageDelivery> deliveries = nSvc.getNotificationMessageDeliveries(n, TestConstants.TEST_USER_FIVE);
66 assertNotNull(deliveries);
67 assertEquals(TestConstants.NUM_OF_MSG_DELIVS_FOR_NOTIF_1_TEST_USER_5, deliveries.size());
68 }
69 }