Search in sources :

Example 6 with ClassMockery

use of com.thoughtworks.go.util.ClassMockery in project gocd by gocd.

the class EmailNotificationListenerTest method setUp.

@Before
public void setUp() throws Exception {
    context = new ClassMockery();
    goConfigService = context.mock(GoConfigService.class);
    goMailSenderFactory = context.mock(EmailNotificationListener.GoMailSenderFactory.class);
    emailNotificationListener = new EmailNotificationListener(goConfigService, goMailSenderFactory);
}
Also used : ClassMockery(com.thoughtworks.go.util.ClassMockery) GoConfigService(com.thoughtworks.go.server.service.GoConfigService) Before(org.junit.Before)

Example 7 with ClassMockery

use of com.thoughtworks.go.util.ClassMockery in project gocd by gocd.

the class StageCctrayPresentationModelTest method stageFailingShouldBeTreatedAsCompleted.

@Test
public void stageFailingShouldBeTreatedAsCompleted() throws Exception {
    ClassMockery context = new ClassMockery();
    final Stage stage = context.mock(Stage.class);
    context.checking(new Expectations() {

        {
            allowing(stage).stageState();
            will(returnValue(StageState.Failing));
        }
    });
    StageCctrayPresentationModel presenter = new StageCctrayPresentationModel(null, stage);
    assertThat(presenter.stageActivity(), is("Sleeping"));
}
Also used : Expectations(org.jmock.Expectations) Stage(com.thoughtworks.go.domain.Stage) ClassMockery(com.thoughtworks.go.util.ClassMockery) Test(org.junit.Test)

Example 8 with ClassMockery

use of com.thoughtworks.go.util.ClassMockery in project gocd by gocd.

the class WorkAssignmentsTest method setup.

@Before
public void setup() {
    context = new ClassMockery();
    idleAgentsTopic = context.mock(IdleAgentTopic.class, "idle_topic");
    assignedWorkTopic = context.mock(WorkAssignedTopic.class, "assigned_work_topic");
    context.checking(new Expectations() {

        {
            one(assignedWorkTopic).addListener(with(any(WorkAssignments.class)));
        }
    });
    assignments = new WorkAssignments(idleAgentsTopic, assignedWorkTopic);
    agentIdentifier = new AgentIdentifier("localhost", "127.0.0.1", "uuid");
    agent = new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false);
}
Also used : Expectations(org.jmock.Expectations) AgentRuntimeInfo(com.thoughtworks.go.server.service.AgentRuntimeInfo) AgentIdentifier(com.thoughtworks.go.remote.AgentIdentifier) ClassMockery(com.thoughtworks.go.util.ClassMockery) Before(org.junit.Before)

Example 9 with ClassMockery

use of com.thoughtworks.go.util.ClassMockery in project gocd by gocd.

the class P4OutputParserTest method setUp.

@Before
public void setUp() throws Exception {
    context = new ClassMockery();
    p4Client = context.mock(P4Client.class);
    parser = new P4OutputParser(p4Client);
}
Also used : ClassMockery(com.thoughtworks.go.util.ClassMockery) Before(org.junit.Before)

Example 10 with ClassMockery

use of com.thoughtworks.go.util.ClassMockery in project gocd by gocd.

the class PipelineActiveCheckerTest method setUp.

@Before
public void setUp() throws Exception {
    mockery = new ClassMockery();
    service = mockery.mock(CurrentActivityService.class);
    pipelineIdentifier = new PipelineIdentifier("cruise", 1, "label-1");
    checker = new PipelineActiveChecker(service, pipelineIdentifier);
}
Also used : PipelineIdentifier(com.thoughtworks.go.domain.PipelineIdentifier) ClassMockery(com.thoughtworks.go.util.ClassMockery) Before(org.junit.Before)

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