@Test
public void testCreateFactoryConfiguration() throws Exception {

    
    org.osgi.service.cm.ConfigurationAdmin admin = mock(org.osgi.service.cm.ConfigurationAdmin.class);
    String fpid = "org.apache.aries.jmx.mock.factory";
    Configuration config = mock(Configuration.class);
    
    when(admin.createFactoryConfiguration(eq(fpid))).thenReturn(config);
    when(admin.createFactoryConfiguration(eq(fpid), anyString())).thenReturn(config);
    when(config.getPid()).thenReturn(fpid + "-1260133982371-0");
    
    ConfigurationAdmin mbean = new ConfigurationAdmin(admin);
    assertEquals(fpid + "-1260133982371-0", mbean.createFactoryConfiguration(fpid));
    assertEquals(fpid + "-1260133982371-0", mbean.createFactoryConfigurationForLocation(fpid, "/bundlex"));
    
}