@Test
public void testGetAttributeMetadata() throws Exception {

    String attributeName1 = "attribute_name_1";
    MBeanAttributeInfo mockAttribute1 = createMock(MBeanAttributeInfo.class);
    String attributeName2 = "attribute_name_2";
    MBeanAttributeInfo mockAttribute2 = createMock(MBeanAttributeInfo.class);
    MBeanAttributeInfo[] attributeList = new MBeanAttributeInfo[2];
    attributeList[0] = mockAttribute1;
    attributeList[1] = mockAttribute2;
    expect(mockMBeanInfo.getAttributes()).andReturn(attributeList);
    expect(mockAttribute1.getName()).andReturn(attributeName1);
    expect(mockAttribute2.getName()).andReturn(attributeName2);
    replay(mockMBeanServer, mockSanitizer, mockObjectName, mockMBeanInfo,
            mockAttribute1, mockAttribute2);
    Map<String, MBeanAttributeInfo> attributeMap = webMBeanAdapter.getAttributeMetadata();
    assertEquals(2, attributeMap.size());
    assertEquals(mockAttribute1, attributeMap.get(attributeName1));
    assertEquals(mockAttribute2, attributeMap.get(attributeName2));
    verify(mockMBeanServer, mockSanitizer, mockObjectName, mockMBeanInfo,
            mockAttribute1, mockAttribute2);
}