Search in sources :

Example 1 with EmailNotificationTopic

use of com.thoughtworks.go.server.messaging.EmailNotificationTopic in project gocd by gocd.

the class UniqueEmailSenderTest method shouldSendEmailIfNotEnoughSpaceForFirstTime.

@Test
public void shouldSendEmailIfNotEnoughSpaceForFirstTime() {
    ClassMockery mockery = new ClassMockery();
    final EmailNotificationTopic topic = mockery.mock(EmailNotificationTopic.class);
    final SendEmailMessage message = new SendEmailMessage("pavan", "hu kai", "someone");
    mockery.checking(new Expectations() {

        {
            one(topic).post(message);
        }
    });
    EmailSender sender = new AsynchronousEmailSender(topic);
    sender.sendEmail(message);
}
Also used : Expectations(org.jmock.Expectations) SendEmailMessage(com.thoughtworks.go.server.messaging.SendEmailMessage) EmailNotificationTopic(com.thoughtworks.go.server.messaging.EmailNotificationTopic) ClassMockery(com.thoughtworks.go.util.ClassMockery) Test(org.junit.Test)

Example 2 with EmailNotificationTopic

use of com.thoughtworks.go.server.messaging.EmailNotificationTopic in project gocd by gocd.

the class UniqueEmailSenderTest method shouldBeAbleToSend2Emails.

@Test
public void shouldBeAbleToSend2Emails() {
    ClassMockery mockery = new ClassMockery();
    final EmailNotificationTopic topic = mockery.mock(EmailNotificationTopic.class);
    final SendEmailMessage message = new SendEmailMessage("pavan", "hu kai", "someone");
    mockery.checking(new Expectations() {

        {
            exactly(2).of(topic).post(message);
        }
    });
    EmailSender sender = new AsynchronousEmailSender(topic);
    sender.sendEmail(message);
    sender.sendEmail(message);
}
Also used : Expectations(org.jmock.Expectations) SendEmailMessage(com.thoughtworks.go.server.messaging.SendEmailMessage) EmailNotificationTopic(com.thoughtworks.go.server.messaging.EmailNotificationTopic) ClassMockery(com.thoughtworks.go.util.ClassMockery) Test(org.junit.Test)

Aggregations

EmailNotificationTopic (com.thoughtworks.go.server.messaging.EmailNotificationTopic)2 SendEmailMessage (com.thoughtworks.go.server.messaging.SendEmailMessage)2 ClassMockery (com.thoughtworks.go.util.ClassMockery)2 Expectations (org.jmock.Expectations)2 Test (org.junit.Test)2