Bundle b = control.createMock(Bundle.class);
Hashtable<String, String> ht = new Hashtable<String, String>();
EasyMock.expect(b.getHeaders()).andReturn(ht).anyTimes();
final Map<Object, Dictionary> services = new HashMap<Object, Dictionary>();
BundleContext bc = control.createMock(BundleContext.class);
EasyMock.expect(bc.registerService(
(String) EasyMock.anyObject(),
EasyMock.anyObject(),
(Dictionary) EasyMock.anyObject())).andAnswer(new IAnswer<ServiceRegistration>() {
public ServiceRegistration answer() throws Throwable {