@Test
public void shouldCreateJMXConnectorWithTheCorrectNameAndPort() throws Exception {

    final String host = "localhost";
    final int port = 2384;
    final Map<String, Object> environment = of("name", "value");
    final JmxParameters jmxParameters = jmxParameters()
            .withHost(host)
            .withPort(port)
            .build();
    final JMXServiceURL serviceURL = mock(JMXServiceURL.class);
    final JMXConnector jmxConnector = mock(JMXConnector.class);
    when(jmxUrlFactory.createUrl(host, port)).thenReturn(serviceURL);
    when(connectorWrapper.connect(serviceURL, environment)).thenReturn(jmxConnector);
    when(environmentFactory.create(jmxParameters)).thenReturn(environment);
    assertThat(jmxConnectorFactory.createJmxConnector(jmxParameters), is(jmxConnector));
}