TestSlingAdaptable data = new TestSlingAdaptable();
assertNull("Expect no adapter", am.getAdapter(data, ITestAdapter.class));
Bundle bundle = new MockBundle(1L);
MockServiceReference ref = new MockServiceReference(bundle);
ref.setProperty(Constants.SERVICE_ID, 1L);
ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable.class.getName() });
ref.setProperty(AdapterFactory.ADAPTER_CLASSES, ITestAdapter.class.getName());
am.bindAdapterFactory(ref);
ref = new MockServiceReference(bundle);
ref.setProperty(Constants.SERVICE_ID, 2L);
ref.setProperty(AdapterFactory.ADAPTABLE_CLASSES, new String[]{ TestSlingAdaptable2.class.getName() });
ref.setProperty(AdapterFactory.ADAPTER_CLASSES, TestAdapter.class.getName());
am.bindAdapterFactory(ref);
Object adapter = am.getAdapter(data, ITestAdapter.class);
assertNotNull(adapter);
assertTrue(adapter instanceof ITestAdapter);