@Test
public void testGetAttributeValues() throws Exception {

    MBeanAttributeInfo[] attributeInfoArray = new MBeanAttributeInfo[2];
    MBeanAttributeInfo mockAttributeInfo1 = createMock(MBeanAttributeInfo.class);
    MBeanAttributeInfo mockAttributeInfo2 = createMock(MBeanAttributeInfo.class);
    attributeInfoArray[0] = mockAttributeInfo1;
    attributeInfoArray[1] = mockAttributeInfo2;
    expect(mockMBeanInfo.getAttributes()).andReturn(attributeInfoArray);
    String attributeName1 = "attribute_name_1";
    String attributeName2 = "attribute_name_2";
    expect(mockAttributeInfo1.getName()).andReturn(attributeName1);
    expect(mockAttributeInfo2.getName()).andReturn(attributeName2);
    AttributeList mockAttributeList = createMock(AttributeList.class);
    expect(mockMBeanServer.getAttributes(eq(mockObjectName), anyObject(String[].class))).andReturn(mockAttributeList);
    List<Attribute> attributeList = new ArrayList<Attribute>();
    Attribute mockAttribute1 = createMock(Attribute.class);
    Attribute mockAttribute2 = createMock(Attribute.class);
    attributeList.add(mockAttribute1);
    attributeList.add(mockAttribute2);
    expect(mockAttributeList.asList()).andReturn(attributeList);
    String name1 = "name 1";
    String value1 = "value 1";
    expect(mockAttribute1.getName()).andReturn(name1);
    expect(mockAttribute1.getValue()).andReturn(value1);
    expect(mockSanitizer.escapeValue(value1)).andReturn(value1);
    String name2 = "name 2";
    String value2 = "value 2";
    expect(mockAttribute2.getName()).andReturn(name2);
    expect(mockAttribute2.getValue()).andReturn(value2);
    expect(mockSanitizer.escapeValue(value2)).andReturn(value2);
    replay(mockMBeanServer, mockSanitizer, mockObjectName, mockMBeanInfo,
            mockAttributeInfo1, mockAttributeInfo2, mockAttributeList,
            mockAttribute1, mockAttribute2);
    Map<String, Object> attributeValueMap = webMBeanAdapter.getAttributeValues();
    assertEquals(2, attributeValueMap.size());
    assertEquals(value1, attributeValueMap.get(name1));
    assertEquals(value2, attributeValueMap.get(name2));
    verify(mockMBeanServer, mockSanitizer, mockObjectName, mockMBeanInfo,
            mockAttributeInfo1, mockAttributeInfo2, mockAttributeList,
            mockAttribute1, mockAttribute2);
}