Search in sources :

Example 11 with ClassMockery

use of com.thoughtworks.go.util.ClassMockery 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

ClassMockery (com.thoughtworks.go.util.ClassMockery)11 Before (org.junit.Before)7 Expectations (org.jmock.Expectations)6 Test (org.junit.Test)4 EmailNotificationTopic (com.thoughtworks.go.server.messaging.EmailNotificationTopic)2 SendEmailMessage (com.thoughtworks.go.server.messaging.SendEmailMessage)2 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 JobInstance (com.thoughtworks.go.domain.JobInstance)1 PipelineIdentifier (com.thoughtworks.go.domain.PipelineIdentifier)1 Stage (com.thoughtworks.go.domain.Stage)1 AgentIdentifier (com.thoughtworks.go.remote.AgentIdentifier)1 WorkAssignmentPerformanceLogger (com.thoughtworks.go.server.perf.WorkAssignmentPerformanceLogger)1 AgentRuntimeInfo (com.thoughtworks.go.server.service.AgentRuntimeInfo)1 BuildAssignmentService (com.thoughtworks.go.server.service.BuildAssignmentService)1 GoConfigService (com.thoughtworks.go.server.service.GoConfigService)1 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)1 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)1 File (java.io.File)1