final BundleContext bundleCtx = this.context.mock(BundleContext.class);
final Filter filter = this.context.mock(Filter.class);
final ComponentContext ctx = this.context.mock(ComponentContext.class);
this.context.checking(new Expectations() {{
allowing(ctx).locateService(with(any(String.class)), with(any(ServiceReference.class)));
will(returnValue(new MockAdapterFactory()));
allowing(ctx).getBundleContext();
will(returnValue(bundleCtx));
allowing(bundleCtx).createFilter(with(any(String.class)));
will(returnValue(filter));
allowing(bundleCtx).addServiceListener(with(any(ServiceListener.class)), with(any(String.class)));