public void testDefaultAnnotation2BMDFactory() throws Throwable {
    BeanMetaData bmd1 = AnnotationToBeanMetaDataFactory.createBeanMetaData(AllIoCAnnotations.class);
    testBMD(bmd1);

    bmd1 =
        AnnotationToBeanMetaDataFactory.createBeanMetaData(
            AllIoCAnnotations.class, BeanAccessMode.ALL);
    testBMD(bmd1);

    bmd1 = AnnotationToBeanMetaDataFactory.createBeanMetaData(ConstructorAnnotationTester.class);
    ConstructorMetaData cmd = bmd1.getConstructor();
    assertNotNull(cmd);
    List<ParameterMetaData> parameters = cmd.getParameters();
    assertNotNull(parameters);
    assertEquals(1, parameters.size());
  }
 public void testIllegalAccessMode() throws Throwable {
   AbstractBeanMetaData abmd = new AbstractBeanMetaData();
   abmd.setAccessMode(BeanAccessMode.FIELDS);
   try {
     AnnotationToBeanMetaDataFactory.fillBeanMetaData(Object.class, BeanAccessMode.ALL, abmd);
     fail("Should not be here.");
   } catch (Throwable t) {
     assertInstanceOf(t, IllegalArgumentException.class);
   }
 }
  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());
  }
 public void testCustomAdapter() throws Throwable {
   BeanMetaData bmd =
       AnnotationToBeanMetaDataFactory.createBeanMetaData(
           Object.class, new SimpleBeanMetaDataAnnotationAdapter());
   assertEquals(ControllerMode.ASYNCHRONOUS, bmd.getMode());
 }