public void testMBeanInfoIsDeterminedIfKeyIsString() {
    final ComponentAdapter componentAdapter =
        pico.addComponent("JUnit", Person.class).getComponentAdapter("JUnit");
    pico.addComponent("JUnitMBeanInfo", Person.createMBeanInfo());

    final MBeanInfo info = mBeanProvider.provide(pico, componentAdapter);
    assertNotNull(info);
    assertEquals(Person.createMBeanInfo().getDescription(), info.getDescription());
  }
  public void testMBeanInfoIsDeterminedIfKeyIsManagementInterface() {
    final ComponentAdapter componentAdapter =
        pico.addComponent(PersonMBean.class, Person.class)
            .getComponentAdapter(PersonMBean.class, null);
    pico.addComponent(PersonMBean.class.getName() + "Info", Person.createMBeanInfo());

    final MBeanInfo info = mBeanProvider.provide(pico, componentAdapter);
    assertNotNull(info);
    assertEquals(Person.createMBeanInfo().getDescription(), info.getDescription());
  }
  public void testMBeanInfoIsDeterminedIfKeyIsType() {
    final PersonMBean person = new OtherPerson();

    final Mock mockComponentAdapter = mock(ComponentAdapter.class);
    mockComponentAdapter.stubs().method("getComponentKey").will(returnValue(Person.class));
    mockComponentAdapter
        .stubs()
        .method("getComponentImplementation")
        .will(returnValue(person.getClass()));

    pico.addAdapter((ComponentAdapter) mockComponentAdapter.proxy());
    pico.addComponent(Person.class.getName() + "MBeanInfo", Person.createMBeanInfo());

    final MBeanInfo info =
        mBeanProvider.provide(pico, (ComponentAdapter) mockComponentAdapter.proxy());
    assertNotNull(info);
    assertEquals(Person.createMBeanInfo().getDescription(), info.getDescription());
  }