@Test
public void detect() throws MalformedObjectNameException, InstanceNotFoundException, ReflectionException, AttributeNotFoundException, MBeanException {

    ServerDetector detector = new WebsphereDetector();
    ObjectName serverMbean = new ObjectName(SERVER_MBEAN);
    MBeanServer mockServer = createMock(MBeanServer.class);
    expect(mockServer.queryNames(new ObjectName("*:j2eeType=J2EEServer,type=Server,*"),null)).
            andStubReturn(new HashSet<ObjectName>(Arrays.asList(serverMbean)));
    expect(mockServer.isRegistered(serverMbean)).andStubReturn(true);
    expect(mockServer.getAttribute(serverMbean,"platformName")).andReturn("IBM WebSphere Application Server");
    expect(mockServer.getAttribute(serverMbean,"serverVersion")).andReturn(SERVER_VERSION_V6);
    replay(mockServer);
    ServerHandle info = detector.detect(getMBeanServerManager(mockServer));
    assertEquals(info.getVendor(),"IBM");
    assertEquals(info.getProduct(),"websphere");
    assertNotNull(info.getExtraInfo(null));
    assertEquals(info.getExtraInfo(null).get("buildDate"),"8/14/10");
}