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.NotificationBo;
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 import org.kuali.rice.test.BaselineTestCase;
25
26 import java.util.Collection;
27
28 import static org.junit.Assert.*;
29
30
31
32
33
34 @BaselineTestCase.BaselineMode(BaselineTestCase.Mode.CLEAR_DB)
35 public class NotificationMessageDeliveryServiceImplTest extends KENTestCase {
36
37 @Test
38 public void testGetNotificationMessageDelivery_validId() {
39 NotificationMessageDeliveryService nSvc = services.getNotificationMessageDeliveryService();
40
41 NotificationMessageDelivery nmd = nSvc.getNotificationMessageDelivery(TestConstants.VALID_MESSAGE_DELIVERY_ID);
42
43 assertNotNull(nmd.getMessageDeliveryStatus());
44 }
45
46 @Test
47 public void testGetNotification_nonExistentNotification() {
48 NotificationMessageDeliveryService nSvc = services.getNotificationMessageDeliveryService();
49
50 NotificationMessageDelivery nmd = nSvc.getNotificationMessageDelivery(TestConstants.NON_EXISTENT_ID);
51
52 assertNull(nmd);
53 }
54
55 @Test
56 public void testGetAllNotificationMessageDeliveries() {
57 NotificationMessageDeliveryService nSvc = services.getNotificationMessageDeliveryService();
58 Collection<NotificationMessageDelivery> deliveries = nSvc.getNotificationMessageDeliveries();
59 assertNotNull(deliveries);
60 assertEquals(TestConstants.NUM_OF_MSG_DELIVS_IN_TEST_DATA, deliveries.size());
61 }
62
63 @Test
64 public void testGetSpecificNotificationMessageDeliveries() {
65 NotificationBo n = services.getNotificationService().getNotification(TestConstants.NOTIFICATION_1);
66 NotificationMessageDeliveryService nSvc = services.getNotificationMessageDeliveryService();
67 Collection<NotificationMessageDelivery> deliveries = nSvc.getNotificationMessageDeliveries(n, TestConstants.TEST_USER_FIVE);
68 assertNotNull(deliveries);
69 assertEquals(TestConstants.NUM_OF_MSG_DELIVS_FOR_NOTIF_1_TEST_USER_5, deliveries.size());
70 }
71 }