Program: 93948
Project: 93948
Buggy source:
@Test public void testStartAndStop() throws Exception {
  StubBundleContext bundleContext=new StubBundleContext();
  StubBundleContext surrogateBundleContext=new StubBundleContext();
  Framework user=createMock(Framework.class);
  SurrogateBundle surrogate=createMock(SurrogateBundle.class);
  ServiceFactory serviceFactory=createMock(ServiceFactory.class);
  CompositeBundleFactory factory=createMock(CompositeBundleFactory.class);
  CompositeBundle bundle=createMock(CompositeBundle.class);
  expect(factory.installCompositeBundle(isA(Map.class),isA(String.class),isA(Map.class))).andReturn(bundle);
  expect(bundle.getCompositeFramework()).andReturn(user);
  bundle.start();
  expect(bundle.getSurrogateBundle()).andReturn(surrogate);
  expect(surrogate.getBundleContext()).andReturn(surrogateBundleContext);
  EventAdmin eventAdmin=createMock(EventAdmin.class);
  eventAdmin.sendEvent(isA(Event.class));
  Dictionary<String,String> properties=new Hashtable<String,String>();
  Configuration config=createMock(Configuration.class);
  expect(config.getProperties()).andReturn(properties);
  ConfigurationAdmin configAdmin=createMock(ConfigurationAdmin.class);
  expect(configAdmin.getConfiguration(isA(String.class))).andReturn(config);
  EventLogger eventLogger=createMock(EventLogger.class);
  Shutdown shutdown=createMock(Shutdown.class);
  replay(factory,bundle,surrogate,eventAdmin,configAdmin,config);
  RegionManager manager=new RegionManager(bundleContext,factory,eventAdmin,serviceFactory,configAdmin,eventLogger,shutdown);
  manager.start();
  List<StubServiceRegistration> serviceRegistrations=bundleContext.getServiceRegistrations();
  assertEquals("String_Node_Str",2,serviceRegistrations.size());
  manager.stop();
  verify(factory,bundle,surrogate,eventAdmin,configAdmin,config);
}

Fixed version (ground truth):
@Test public void testStartAndStop() throws Exception {
  StubBundleContext bundleContext=new StubBundleContext();
  StubBundleContext surrogateBundleContext=new StubBundleContext();
  Framework user=createMock(Framework.class);
  SurrogateBundle surrogate=createMock(SurrogateBundle.class);
  ServiceFactory<EventLogger> serviceFactory=createMock(ServiceFactory.class);
  CompositeBundleFactory factory=createMock(CompositeBundleFactory.class);
  CompositeBundle bundle=createMock(CompositeBundle.class);
  expect(factory.installCompositeBundle(isA(Map.class),isA(String.class),isA(Map.class))).andReturn(bundle);
  expect(bundle.getCompositeFramework()).andReturn(user);
  bundle.start();
  expect(bundle.getSurrogateBundle()).andReturn(surrogate);
  expect(surrogate.getBundleContext()).andReturn(surrogateBundleContext);
  EventAdmin eventAdmin=createMock(EventAdmin.class);
  eventAdmin.sendEvent(isA(Event.class));
  Dictionary<String,String> properties=new Hashtable<String,String>();
  Configuration config=createMock(Configuration.class);
  expect(config.getProperties()).andReturn(properties);
  ConfigurationAdmin configAdmin=createMock(ConfigurationAdmin.class);
  expect(configAdmin.getConfiguration(isA(String.class))).andReturn(config);
  EventLogger eventLogger=createMock(EventLogger.class);
  Shutdown shutdown=createMock(Shutdown.class);
  replay(factory,bundle,surrogate,eventAdmin,configAdmin,config);
  RegionManager manager=new RegionManager(bundleContext,factory,eventAdmin,serviceFactory,configAdmin,eventLogger,shutdown);
  manager.start();
  List<StubServiceRegistration<Object>> serviceRegistrations=bundleContext.getServiceRegistrations();
  assertEquals("String_Node_Str",2,serviceRegistrations.size());
  manager.stop();
  verify(factory,bundle,surrogate,eventAdmin,configAdmin,config);
}