@Test
public void testInvokeOperation() throws JMException {

    MBeanParameterInfo mockParameterInfo1 = createMock(MBeanParameterInfo.class);
    MBeanParameterInfo mockParameterInfo2 = createMock(MBeanParameterInfo.class);
    MBeanParameterInfo[] parameterInfoArray = new MBeanParameterInfo[] { mockParameterInfo1, mockParameterInfo2 };
    expect(mockOperationInfo.getSignature()).andReturn(parameterInfoArray);
    String name1 = "name 1";
    String type1 = "type 1";
    expect(mockParameterInfo1.getType()).andReturn(type1);
    expect(mockParameterInfo1.getName()).andReturn(name1);
    String value1 = "value 1";
    expect(mockValueConverter.convertParameterValue(name1, type1)).andReturn(value1);
    String name2 = "name 2";
    String type2 = "type 2";
    expect(mockParameterInfo2.getType()).andReturn(type2);
    expect(mockParameterInfo2.getName()).andReturn(name2);
    String value2 = "value 2";
    expect(mockValueConverter.convertParameterValue(name2, type2)).andReturn(value2);
    String operationName = "some_operation_name";
    expect(mockOperationInfo.getName()).andReturn(operationName);
    Object value = new Object();
    expect(mockMBeanServer.invoke(eq(mockObjectName), eq(operationName), anyObject(String[].class), anyObject(String[].class))).andReturn(value);
    replay(mockMBeanServer, mockObjectName, mockOperationInfo, mockValueConverter,
            mockParameterInfo1, mockParameterInfo2);
    Map<String, String[]> parameterMap = new HashMap<String, String[]>();
    parameterMap.put(name1, new String[] { value1 });
    parameterMap.put(name2, new String[] { value2 });
    Object invokeResult = invoker.invokeOperation(parameterMap);
    assertEquals(value, invokeResult);
    verify(mockMBeanServer, mockObjectName, mockOperationInfo, mockValueConverter,
            mockParameterInfo1, mockParameterInfo2);
}