com.silverpeas.comment.service.notification
Class CommentUserNotificationServiceTest

java.lang.Object
  extended by com.silverpeas.comment.service.notification.CommentUserNotificationServiceTest

@ContextConfiguration(locations="/spring-comment-user-notification.xml")
public class CommentUserNotificationServiceTest
extends Object

Unit tests notification of the users at comment adding on a given Silverpeas content.


Constructor Summary
CommentUserNotificationServiceTest()
           
 
Method Summary
protected static Classified aClassified()
           
protected  void addAUserWithoutEnoughAccessRights()
           
 void commentAddedShouldNotifyClassifiedAndCommentAuthors()
          The commentAdded() method should notify both the author of the commented ad and the authors of all of the ad's comments.
protected  NotificationMetaData getCapturedInfoInNotification()
          Gets the captured information from the notification sender at notifiyUser() call by the callback.
protected  CommentService mockCommentService()
          Mocks the DefaultCommentService to use by the callback.
protected  void mockGetUserDetailReturnedValue()
           
protected  NotificationSender mockNotificationSender()
          Mocks the NotificationSender instance to use by the callback.
 void notificationsAreNotSentToUsersWithoutEnoughAccessRights()
          Tests the notification about a comment isn't sent to the users that don't have enough rights to access the commented resource.
 void setUp()
           
static void setUpClass()
           
protected  void setUpClassifiedComments()
          Sets up all of the comments about the classified used in the current test.
protected  void setUpClassifieds()
           
 void tearDown()
           
static void tearDownClass()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommentUserNotificationServiceTest

public CommentUserNotificationServiceTest()
Method Detail

setUpClass

public static void setUpClass()
                       throws Exception
Throws:
Exception

tearDownClass

public static void tearDownClass()
                          throws Exception
Throws:
Exception

setUp

public void setUp()
           throws Exception
Throws:
Exception

tearDown

public void tearDown()

commentAddedShouldNotifyClassifiedAndCommentAuthors

public void commentAddedShouldNotifyClassifiedAndCommentAuthors()
                                                         throws Exception
The commentAdded() method should notify both the author of the commented ad and the authors of all of the ad's comments.

Throws:
Exception - if an error occurs during the test.

notificationsAreNotSentToUsersWithoutEnoughAccessRights

public void notificationsAreNotSentToUsersWithoutEnoughAccessRights()
                                                             throws Exception
Tests the notification about a comment isn't sent to the users that don't have enough rights to access the commented resource. To access a commented resource, a user first must have right to access the component instance and then to the commented resource.

Throws:
Exception - if an error occurs during the test.

setUpClassifiedComments

protected void setUpClassifiedComments()
Sets up all of the comments about the classified used in the current test. The comment to use in the invocation of the callback is also set.


addAUserWithoutEnoughAccessRights

protected void addAUserWithoutEnoughAccessRights()

setUpClassifieds

protected void setUpClassifieds()

aClassified

protected static Classified aClassified()

mockCommentService

protected CommentService mockCommentService()
                                     throws Exception
Mocks the DefaultCommentService to use by the callback. It is expected all of other comments are asked by the callback to get their authors. So that it can notify them about the new comment.

Returns:
the mocked comment controller.
Throws:
Exception - - it is just for satisfying the contract of some called methods of DefaultCommentService.

mockNotificationSender

protected NotificationSender mockNotificationSender()
                                             throws Exception
Mocks the NotificationSender instance to use by the callback. It is expected it is used by the callback for sending notification to users. The notification information passed to the sender is captured.

Returns:
the mocked notification sender.
Throws:
Exception - - it is just for satisfying the contract of some called methods of NotifySender.

mockGetUserDetailReturnedValue

protected void mockGetUserDetailReturnedValue()

getCapturedInfoInNotification

protected NotificationMetaData getCapturedInfoInNotification()
Gets the captured information from the notification sender at notifiyUser() call by the callback.

Returns:
the notification information passed by the callback to the notification sender.


Copyright © 2016 Silverpeas. All Rights Reserved.