@Test
public void testGetFactoryPid() throws Exception {

    org.osgi.service.cm.ConfigurationAdmin admin = mock(org.osgi.service.cm.ConfigurationAdmin.class);
    String factoryPid = "org.apache.aries.jmx.factory.mock";
    
    Configuration config = mock(Configuration.class);
    when(admin.getConfiguration(eq(factoryPid  + "-1260133982371-0"), anyString())).thenReturn(config);
    when(config.getFactoryPid()).thenReturn(factoryPid);
    
    ConfigurationAdmin mbean = new ConfigurationAdmin(admin);
    assertEquals(factoryPid, mbean.getFactoryPid(factoryPid  + "-1260133982371-0"));
    assertEquals(factoryPid, mbean.getFactoryPidForLocation(factoryPid  + "-1260133982371-0", "location"));
    
}