001 /** 002 * Copyright 2005-2013 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.rice.ken.services.impl; 017 018 import org.junit.Test; 019 import org.kuali.rice.ken.bo.NotificationBo; 020 import org.kuali.rice.ken.bo.NotificationMessageDelivery; 021 import org.kuali.rice.ken.service.NotificationMessageDeliveryService; 022 import org.kuali.rice.ken.test.KENTestCase; 023 import org.kuali.rice.ken.test.TestConstants; 024 import org.kuali.rice.test.BaselineTestCase; 025 026 import java.util.Collection; 027 028 import static org.junit.Assert.*; 029 030 /** 031 * This class tests the message delivery service implementation 032 * @author Kuali Rice Team (rice.collab@kuali.org) 033 */ 034 @BaselineTestCase.BaselineMode(BaselineTestCase.Mode.CLEAR_DB) 035 public class NotificationMessageDeliveryServiceImplTest extends KENTestCase { 036 037 @Test 038 public void testGetNotificationMessageDelivery_validId() { 039 NotificationMessageDeliveryService nSvc = services.getNotificationMessageDeliveryService(); 040 041 NotificationMessageDelivery nmd = nSvc.getNotificationMessageDelivery(TestConstants.VALID_MESSAGE_DELIVERY_ID); 042 043 assertNotNull(nmd.getMessageDeliveryStatus()); 044 } 045 046 @Test 047 public void testGetNotification_nonExistentNotification() { 048 NotificationMessageDeliveryService nSvc = services.getNotificationMessageDeliveryService(); 049 050 NotificationMessageDelivery nmd = nSvc.getNotificationMessageDelivery(TestConstants.NON_EXISTENT_ID); 051 052 assertNull(nmd); 053 } 054 055 @Test 056 public void testGetAllNotificationMessageDeliveries() { 057 NotificationMessageDeliveryService nSvc = services.getNotificationMessageDeliveryService(); 058 Collection<NotificationMessageDelivery> deliveries = nSvc.getNotificationMessageDeliveries(); 059 assertNotNull(deliveries); 060 assertEquals(TestConstants.NUM_OF_MSG_DELIVS_IN_TEST_DATA, deliveries.size()); 061 } 062 063 @Test 064 public void testGetSpecificNotificationMessageDeliveries() { 065 NotificationBo n = services.getNotificationService().getNotification(TestConstants.NOTIFICATION_1); 066 NotificationMessageDeliveryService nSvc = services.getNotificationMessageDeliveryService(); 067 Collection<NotificationMessageDelivery> deliveries = nSvc.getNotificationMessageDeliveries(n, TestConstants.TEST_USER_FIVE); 068 assertNotNull(deliveries); 069 assertEquals(TestConstants.NUM_OF_MSG_DELIVS_FOR_NOTIF_1_TEST_USER_5, deliveries.size()); 070 } 071 }