- @SuppressWarnings("unchecked")
- @Before
- public void setUp() throws NoSuchFieldException, IllegalAccessException {
- PowerMockito.mockStatic(FrameworkUtil.class);
- PowerMockito.when(FrameworkUtil.getBundle(Matchers.any(Class.class))).thenReturn(bundleService);
- PowerMockito.when(bundleService.getBundleContext()).thenReturn(bundleContext);
- PowerMockito.when(bundleContext.getServiceReference(Matchers.any(Class.class))).thenReturn(sref);
- PowerMockito.when(bundleContext.<MessageAdapterFactory>getService(sref)).thenReturn(mockFactory);
- PowerMockito.when(mockFactory.createProducer(Matchers.anyCollection(), Mockito.anyString(), Mockito.anyString(),
- Mockito.anyString())).thenReturn(mockProducer);
- }