public void testProvidedMetaData() throws Throwable {
    MemoryMetaDataLoader memory =
        new MemoryMetaDataLoader(new ScopeKey(CommonLevels.INSTANCE, "foobar"));
    memory.addAnnotation(new AliasesImpl("alias"));
    MetaDataRetrieval retrieval = new AbstractMetaDataContext(null, memory);
    MetaData metaData = new MetaDataRetrievalToMetaDataBridge(retrieval);

    BeanMetaData bmd = AnnotationToBeanMetaDataFactory.createBeanMetaData(Object.class, metaData);
    assertNotNull(bmd);
    assertEquals(Collections.singleton((Object) "alias"), bmd.getAliases());
  }
  protected void testBMD(BeanMetaData bmd) throws Throwable {
    assertNotNull(bmd);
    assertEquals(Collections.singleton((Object) "alias"), bmd.getAliases());
    assertEquals(
        Collections.singleton((SupplyMetaData) new AbstractSupplyMetaData("supply")),
        bmd.getSupplies());
    assertEquals(
        Collections.singleton((DemandMetaData) new AbstractDemandMetaData("demand")),
        bmd.getDemands());
    assertEquals(
        Collections.singleton((DependencyMetaData) new AbstractDependencyMetaData("depend")),
        bmd.getDepends());
    ConstructorMetaData cmd = bmd.getConstructor();
    assertNotNull(cmd);
    assertEquals(AnnotationTester.class.getName(), cmd.getFactoryClass());
    assertEquals("factoryMethod", cmd.getFactoryMethod());
    testInstalls(bmd.getInstalls());
    testInstalls(bmd.getUninstalls());

    List<CallbackMetaData> callbacks = bmd.getInstallCallbacks();
    assertNotNull(callbacks);
    assertEquals(1, callbacks.size());
    CallbackMetaData callback = callbacks.get(0);
    assertTrue(callback.getMethodName().contains("Something"));
    callbacks = bmd.getUninstallCallbacks();
    assertNotNull(callbacks);
    assertEquals(1, callbacks.size());
    callback = callbacks.get(0);
    assertTrue(callback.getMethodName().contains("Something"));

    BeanAccessMode mode = bmd.getAccessMode();
    if (mode == BeanAccessMode.ALL) {
      Set<PropertyMetaData> propertys = bmd.getProperties();
      assertNotNull(propertys);
      assertEquals(2, propertys.size());
    } else {
      Set<PropertyMetaData> propertys = bmd.getProperties();
      assertNotNull(propertys);
      assertEquals(1, propertys.size());
      PropertyMetaData pmd = propertys.iterator().next();
      assertEquals("number", pmd.getName());
      assertInstanceOf(pmd.getValue(), AbstractDependencyValueMetaData.class);
    }
    testLifecycle(bmd.getCreate(), "myCreate");
    testLifecycle(bmd.getStart(), "myStart");
    testLifecycle(bmd.getStop(), "myStop");
    testLifecycle(bmd.getDestroy(), "myDestroy");
  }