CommandMBeanNameProvider { public ObjectName create(final String contextName) { return objectNameFactory.create( DOMAIN_NAME, TYPE, format(OBJECT_NAME_FORMAT, contextName)); }  ObjectName create(final String contextName);  }
@Test public void shouldCreateTheCorrectObjectNameForTheSystemCommanderMBean() throws Exception { final String contextName = "people"; final ObjectName objectName = mock(ObjectName.class); when(objectNameFactory.create( "uk.gov.justice.services.framework.management", "type", "people-system-command-handler-mbean")).thenReturn(objectName); assertThat(commandMBeanNameProvider.create(contextName), is(objectName)); }