private Bundle[] createBundles() {
Bundle bundle1 = createBundle(1, "Bundle A");
Bundle bundle2 = createBundle(2, "Bundle B");
Bundle bundle3 = createBundle(3, "Bundle C");
BundleStartLevel bsl = createMock(BundleStartLevel.class);
ServiceReference<?> ref1 = createServiceRef(Constants.OBJECTCLASS, new String[]{"org.example.MyService"},
"key1", "value1");
ServiceReference<?> ref2 = createServiceRef(Constants.OBJECTCLASS, new String[]{"org.example.OtherService"}, "key2", 1);
addRegisteredServices(bundle1, ref1, ref2);
addRegisteredServices(bundle2, ref2);
expect(bundle3.getRegisteredServices()).andReturn(null).anyTimes();
expect(bundle1.getServicesInUse()).andReturn(null).anyTimes();
addUsedServices(bundle2, ref1);
addUsedServices(bundle3, ref1, ref2);
expect(ref1.getUsingBundles()).andReturn(new Bundle[]{bundle2, bundle3}).anyTimes();
expect(ref2.getUsingBundles()).andReturn(new Bundle[]{bundle3}).anyTimes();
expect(bundle1.adapt(BundleStartLevel.class)).andReturn(bsl).anyTimes();
expect(bundle2.adapt(BundleStartLevel.class)).andReturn(bsl).anyTimes();
expect(bundle3.adapt(BundleStartLevel.class)).andReturn(bsl).anyTimes();
expect(bsl.getStartLevel()).andReturn(80).anyTimes();
replay(bundle1, bundle2, bundle3, ref1, ref2, bsl);
return new Bundle[] { bundle1, bundle2, bundle3 };
}