/* * Copyright (c) 2010 Lockheed Martin Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.eurekastreams.server.action.execution.notification.translator; import java.util.Arrays; import java.util.Collection; import org.eurekastreams.server.domain.EntityType; import org.eurekastreams.server.domain.NotificationDTO; import org.eurekastreams.server.domain.NotificationType; import org.junit.Assert; import org.junit.Test; /** * Tests the follower notification translator. * */ public class FollowerTranslatorTest { /** Test data. */ private static final long ACTOR_ID = 1111L; /** Test data. */ private static final long FOLLOWED_ID = 2222L; /** * Test creating the notification for the event of following a person. */ @Test public void testTranslateFollowPerson() { FollowerTranslator sut = new FollowerTranslator(); Collection<NotificationDTO> notifs = sut.translate(ACTOR_ID, FOLLOWED_ID, 0L); Assert.assertNotNull(notifs); Assert.assertEquals(1, notifs.size()); NotificationDTO notif = notifs.iterator().next(); NotificationDTO expected = new NotificationDTO(Arrays.asList(FOLLOWED_ID), NotificationType.FOLLOW_PERSON, ACTOR_ID, FOLLOWED_ID, EntityType.PERSON, 0L); Assert.assertEquals(expected.getActivityId(), notif.getActivityId()); Assert.assertEquals(expected.getType(), notif.getType()); Assert.assertEquals(expected.getDestinationId(), notif.getDestinationId()); } }