use of org.jmock.Mockery in project RoboBinding by RoboBinding.
the class ElementWrapperTest method whenWrapSupportedElements_thenReturnCoorespondingWrappedInstance.
@Theory
public void whenWrapSupportedElements_thenReturnCoorespondingWrappedInstance(@FromDataPoints("supportedElements") ElementToWrapped elementToWrapped) {
Mockery context = new ClassMockery();
final TypeMirrorWrapper typeWrapper = context.mock(TypeMirrorWrapper.class);
context.checking(new Expectations() {
{
allowing(typeWrapper).wrap(with(any(TypeMirror.class)));
will(returnValue(null));
}
});
ElementWrapper wrapper = new ElementWrapper(typeWrapper, null, null, null);
AbstractWrappedElement wrapped = wrapper.wrap(elementToWrapped.element);
assertThat(wrapped, isA(elementToWrapped.wrappedType));
}
use of org.jmock.Mockery in project geode by apache.
the class SerializableObjectHttpMessageConverterJUnitTest method setUp.
@Before
public void setUp() {
mockContext = new Mockery();
mockContext.setImposteriser(ClassImposteriser.INSTANCE);
mockContext.setThreadingPolicy(new Synchroniser());
}
use of org.jmock.Mockery in project geode by apache.
the class InitializerJUnitTest method setUp.
@Before
public void setUp() {
mockContext = new Mockery();
mockContext.setImposteriser(ClassImposteriser.INSTANCE);
mockContext.setThreadingPolicy(new Synchroniser());
}
use of org.jmock.Mockery in project sling by apache.
the class MockFactory method mockSlingSettingsService.
public static SlingSettingsService mockSlingSettingsService(final String slingId) {
Mockery context = new JUnit4Mockery();
final SlingSettingsService settingsService = context.mock(SlingSettingsService.class);
context.checking(new Expectations() {
{
allowing(settingsService).getSlingId();
will(returnValue(slingId));
allowing(settingsService).getSlingHomePath();
will(returnValue("/n/a"));
}
});
return settingsService;
}
use of org.jmock.Mockery in project sling by apache.
the class MockFactory method mockComponentContext.
public static ComponentContext mockComponentContext() {
Mockery context = new JUnit4Mockery();
final BundleContext bc = context.mock(BundleContext.class);
context.checking(new Expectations() {
{
allowing(bc).registerService(with(any(String.class)), with(any(Object.class)), with(any(Dictionary.class)));
will(VoidAction.INSTANCE);
allowing(bc).getProperty(with(any(String.class)));
will(new ReturnValueAction("foo"));
}
});
final ComponentContext cc = context.mock(ComponentContext.class);
context.checking(new Expectations() {
{
allowing(cc).getProperties();
will(returnValue(new Properties()));
allowing(cc).getBundleContext();
will(returnValue(bc));
}
});
return cc;
}
Aggregations