@Test
public void testGetOperationInfoWhenItExists() throws Exception {

    String operationName1 = "operation_name_1";
    MBeanOperationInfo mockOperation1 = createMock(MBeanOperationInfo.class);
    String operationName2 = "operation_name_2";
    MBeanOperationInfo mockOperation2 = createMock(MBeanOperationInfo.class);
    expect(mockSanitizer.urlDecode(operationName2, ENCODING)).andReturn(operationName2);
    MBeanOperationInfo[] operationList = new MBeanOperationInfo[2];
    operationList[0] = mockOperation1;
    operationList[1] = mockOperation2;
    expect(mockMBeanInfo.getOperations()).andReturn(operationList);
    expect(mockOperation1.getName()).andReturn(operationName1);
    expect(mockOperation2.getName()).andReturn(operationName2);
    replay(mockMBeanServer, mockSanitizer, mockObjectName, mockMBeanInfo,
            mockOperation1, mockOperation2);
    MBeanOperationInfo operationInfo = webMBeanAdapter.getOperationInfo(operationName2);
    assertEquals(mockOperation2, operationInfo);
    verify(mockMBeanServer, mockSanitizer, mockObjectName, mockMBeanInfo,
            mockOperation1, mockOperation2);
}