Search in sources :

Example 46 with Mockery

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

the class StageResultTypeHandlerCallbackTest method assertMaps.

private void assertMaps(final String str, StageResult value) throws SQLException {
    final ResultGetter resultGetter;
    Mockery context = new Mockery() {

        {
            setImposteriser(ClassImposteriser.INSTANCE);
        }
    };
    resultGetter = context.mock(ResultGetter.class);
    context.checking(new Expectations() {

        {
            one(resultGetter).getString();
            will(returnValue(str));
        }
    });
    StageResult result = (StageResult) callback.getResult(resultGetter);
    assertThat(result, is(equal(value)));
    final ParameterSetter parameterSetter = context.mock(ParameterSetter.class);
    context.checking(new Expectations() {

        {
            one(parameterSetter).setString(str);
        }
    });
    callback.setParameter(parameterSetter, value);
}
Also used : Expectations(org.jmock.Expectations) StageResult(com.thoughtworks.go.domain.StageResult) ParameterSetter(com.ibatis.sqlmap.client.extensions.ParameterSetter) ResultGetter(com.ibatis.sqlmap.client.extensions.ResultGetter) Mockery(org.jmock.Mockery)

Example 47 with Mockery

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

the class StageStateTypeHandlerCallbackTest method assertMaps.

private void assertMaps(final String str, StageState value) throws SQLException {
    final ResultGetter resultGetter;
    Mockery context = new Mockery() {

        {
            setImposteriser(ClassImposteriser.INSTANCE);
        }
    };
    resultGetter = context.mock(ResultGetter.class);
    context.checking(new Expectations() {

        {
            one(resultGetter).getString();
            will(returnValue(str));
        }
    });
    StageState result = (StageState) callback.getResult(resultGetter);
    assertThat(result, is(equal(value)));
    final ParameterSetter parameterSetter = context.mock(ParameterSetter.class);
    context.checking(new Expectations() {

        {
            one(parameterSetter).setString(str);
        }
    });
    callback.setParameter(parameterSetter, value);
}
Also used : Expectations(org.jmock.Expectations) StageState(com.thoughtworks.go.domain.StageState) ParameterSetter(com.ibatis.sqlmap.client.extensions.ParameterSetter) ResultGetter(com.ibatis.sqlmap.client.extensions.ResultGetter) Mockery(org.jmock.Mockery)

Example 48 with Mockery

use of org.jmock.Mockery in project sling by apache.

the class StartupFilterImplTest method setup.

@Before
public void setup() {
    activeFilterCount = new AtomicInteger();
    mockery = new Mockery();
    request = mockery.mock(HttpServletRequest.class);
    response = mockery.mock(HttpServletResponse.class);
    chain = mockery.mock(FilterChain.class);
    serviceRegistration = mockery.mock(ServiceRegistration.class);
    filter = new TestFilterImpl();
    requestPath = "/NO_PATH_YET";
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) FilterChain(javax.servlet.FilterChain) HttpServletResponse(javax.servlet.http.HttpServletResponse) Mockery(org.jmock.Mockery) ServiceRegistration(org.osgi.framework.ServiceRegistration) Before(org.junit.Before)

Example 49 with Mockery

use of org.jmock.Mockery in project sling by apache.

the class RefreshDependenciesUtilTest method setup.

@Before
public void setup() {
    jmock = new Mockery();
    pa = jmock.mock(PackageAdmin.class);
    rdu = new RefreshDependenciesUtil(pa);
    // Test bundle depends on A directly and does not depend on B
    target = setupBundle("testBundle", "com.targetImportsOne;com.targetImportsTwo", null);
    A = setupBundle("A", null, "com.targetImportsOne");
    B = setupBundle("B", "some.import", "some.export");
    // Test bundle depends on C which in turns depends on D
    C = setupBundle("C", "com.CimportsOne", "com.targetImportsTwo");
    D = setupBundle("D", null, "com.CimportsOne");
    E = setupBundle("E", null, null);
    // F imports and exports the same packages
    F = setupBundle("F", "foo", "foo");
}
Also used : PackageAdmin(org.osgi.service.packageadmin.PackageAdmin) Mockery(org.jmock.Mockery) Before(org.junit.Before)

Example 50 with Mockery

use of org.jmock.Mockery in project geode by apache.

the class CompiledAggregateFunctionJUnitTest method setUp.

@Before
public void setUp() throws Exception {
    context = new Mockery() {

        {
            setImposteriser(ClassImposteriser.INSTANCE);
            setThreadingPolicy(new Synchroniser());
        }
    };
    cache = context.mock(InternalCache.class);
    bucketList = new ArrayList();
    bucketList.add(1);
}
Also used : ArrayList(java.util.ArrayList) InternalCache(org.apache.geode.internal.cache.InternalCache) Synchroniser(org.jmock.lib.concurrent.Synchroniser) Mockery(org.jmock.Mockery) Before(org.junit.Before)

Aggregations

Mockery (org.jmock.Mockery)148 Expectations (org.jmock.Expectations)118 Test (org.junit.Test)77 Before (org.junit.Before)28 ArrayList (java.util.ArrayList)24 Date (java.util.Date)21 JUnit4Mockery (org.jmock.integration.junit4.JUnit4Mockery)17 File (java.io.File)15 BeforeMethod (org.testng.annotations.BeforeMethod)15 Synchroniser (org.jmock.lib.concurrent.Synchroniser)14 List (java.util.List)11 ActorDTO (com.management.dto.ActorDTO)7 FanZoneDTO (com.management.dto.FanZoneDTO)6 PropsDTO (com.management.dto.PropsDTO)6 ActorPerformancesRepository (com.management.repositories.ActorPerformancesRepository)6 ActorRepository (com.management.repositories.ActorRepository)6 CinemaTheatreRepository (com.management.repositories.CinemaTheatreRepository)6 EventRepository (com.management.repositories.EventRepository)6 FriendsListRepository (com.management.repositories.FriendsListRepository)6 PerformanceRepository (com.management.repositories.PerformanceRepository)6