Search in sources :

Example 31 with Mockery

use of org.jmock.Mockery in project gocd by gocd.

the class BuildFailedErrorDetectorTest method setUp.

@Before
public void setUp() {
    context = new Mockery();
    reporter = context.mock(Reporter.class);
    detector = new BuildFailedErrorDetector(reporter);
}
Also used : Mockery(org.jmock.Mockery) Before(org.junit.Before)

Example 32 with Mockery

use of org.jmock.Mockery in project gocd by gocd.

the class SystemServiceTest method shouldPopulateServerDetailsModel.

@Test
public void shouldPopulateServerDetailsModel() {
    Mockery mockery = new Mockery();
    final DbMetadataDao dao = mockery.mock(DbMetadataDao.class);
    mockery.checking(new Expectations() {

        {
            one(dao).getSchemaVersion();
            will(returnValue(20));
        }
    });
    new SystemEnvironment().setProperty("java.version", "1.5");
    new SystemEnvironment().setProperty("os.name", "Linux");
    new SystemEnvironment().setProperty("os.version", "2.6");
    Map<String, Object> model = new HashMap<>();
    new SystemService(dao, null).populateServerDetailsModel(model);
    assertThat(model.get("jvm_version"), is("1.5"));
    assertThat(model.get("os_info"), is("Linux 2.6"));
    assertThat(model.get("schema_version"), is(20));
    mockery.assertIsSatisfied();
}
Also used : Expectations(org.jmock.Expectations) SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) HashMap(java.util.HashMap) Mockery(org.jmock.Mockery) DbMetadataDao(com.thoughtworks.go.server.dao.DbMetadataDao) Test(org.junit.Test)

Aggregations

Mockery (org.jmock.Mockery)32 Before (org.junit.Before)21 Expectations (org.jmock.Expectations)14 Synchroniser (org.jmock.lib.concurrent.Synchroniser)12 HttpServletResponse (javax.servlet.http.HttpServletResponse)4 JUnit4Mockery (org.jmock.integration.junit4.JUnit4Mockery)4 Test (org.junit.Test)4 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 ParameterSetter (com.ibatis.sqlmap.client.extensions.ParameterSetter)2 ResultGetter (com.ibatis.sqlmap.client.extensions.ResultGetter)2 StageDao (com.thoughtworks.go.server.dao.StageDao)2 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 Dictionary (java.util.Dictionary)2 HashMap (java.util.HashMap)2 Servlet (javax.servlet.Servlet)2 BundleContext (org.osgi.framework.BundleContext)2 ComponentContext (org.osgi.service.component.ComponentContext)2 JobInstanceLog (com.thoughtworks.go.domain.JobInstanceLog)1