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);
}
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);
}
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";
}
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");
}
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);
}
Aggregations