// Start the bundle. This will make the BundleWiring available on both the bundle and the fragment
b.start();
// Check the Bundle Wiring on the fragment. It should only contain the osgi.identity capability
// All the other capabilities should have migrated to the bundle's BundleWiring.
BundleWiring fbw = f.adapt(BundleWiring.class);
List<BundleCapability> fbwCaps = fbw.getCapabilities(null);
assertEquals("Fragment should only have 1 capability: it's osgi.identity", 1, fbwCaps.size());
assertCapsEquals(expectedFICap, fbwCaps.get(0));
// Check the Bundle Wiring on the bundle. It should contain all the capabilities originally on the
// bundle and also contain the osgi.wiring.package capability from the fragment.
BundleWiring bbw = b.adapt(BundleWiring.class);
List<BundleCapability> bwbCaps2 = bbw.getCapabilities("osgi.wiring.bundle");
assertEquals(1, bwbCaps2.size());
assertCapsEquals(expectedBWBCap, bwbCaps2.get(0));
List<BundleCapability> bwhCaps2 = bbw.getCapabilities("osgi.wiring.host");
assertEquals(1, bwhCaps2.size());
assertCapsEquals(expectedBWHCap, bwhCaps2.get(0));
List<BundleCapability> bwiCaps2 = bbw.getCapabilities("osgi.identity");
assertEquals(1, bwiCaps2.size());
assertCapsEquals(expectedBWICap, bwiCaps2.get(0));
List<BundleCapability> bwpCaps2 = bbw.getCapabilities("osgi.wiring.package");
assertEquals("Bundle should have inherited the osgi.wiring.package capability from the fragment",
1, bwpCaps2.size());
assertCapsEquals(expectedFWCap, bwpCaps2.get(0));
}