View Javadoc

1   /*
2    * Copyright 2007-2008 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.ken.services.impl;
17  
18  import java.util.Collection;
19  
20  import org.junit.Test;
21  import org.kuali.rice.ken.bo.Notification;
22  import org.kuali.rice.ken.bo.NotificationMessageDelivery;
23  import org.kuali.rice.ken.service.NotificationMessageDeliveryService;
24  import org.kuali.rice.ken.test.KENTestCase;
25  import org.kuali.rice.ken.test.TestConstants;
26  
27  /**
28   * This class tests the message delivery service implementation
29   * @author Kuali Rice Team (rice.collab@kuali.org)
30   */
31  public class NotificationMessageDeliveryServiceImplTest extends KENTestCase {
32  
33      @Test
34      public void testGetNotificationMessageDelivery_validId() {
35          NotificationMessageDeliveryService nSvc = services.getNotificationMessageDeliveryService();
36  
37          NotificationMessageDelivery nmd = nSvc.getNotificationMessageDelivery(TestConstants.VALID_MESSAGE_DELIVERY_ID);
38  
39          assertNotNull(nmd.getMessageDeliveryStatus());
40      }
41  
42      @Test
43      public void testGetNotification_nonExistentNotification() {
44          NotificationMessageDeliveryService nSvc = services.getNotificationMessageDeliveryService();
45  
46          NotificationMessageDelivery nmd = nSvc.getNotificationMessageDelivery(TestConstants.NON_EXISTENT_ID);
47  
48          assertNull(nmd);
49      }
50  
51      @Test
52      public void testGetAllNotificationMessageDeliveries() {
53          NotificationMessageDeliveryService nSvc = services.getNotificationMessageDeliveryService();
54          Collection<NotificationMessageDelivery> deliveries = nSvc.getNotificationMessageDeliveries();
55          assertNotNull(deliveries);
56          assertEquals(TestConstants.NUM_OF_MSG_DELIVS_IN_TEST_DATA, deliveries.size());
57      }
58  
59      @Test
60      public void testGetSpecificNotificationMessageDeliveries() {
61          Notification n = services.getNotificationService().getNotification(TestConstants.NOTIFICATION_1);
62          NotificationMessageDeliveryService nSvc = services.getNotificationMessageDeliveryService();
63          Collection<NotificationMessageDelivery> deliveries = nSvc.getNotificationMessageDeliveries(n, TestConstants.TEST_USER_FIVE);
64          assertNotNull(deliveries);
65          assertEquals(TestConstants.NUM_OF_MSG_DELIVS_FOR_NOTIF_1_TEST_USER_5, deliveries.size());
66      }
67  }