mil.dod.th.ose.test/src/mil/dod/th/ose/test/BundleContextMocker.java
@SuppressWarnings("unchecked")
    public static <T> ServiceRegistration<T> stubServiceRegistration(BundleContext context, Class<T> clazz)
    {
        ServiceRegistration<T> serviceRegistration = mock(ServiceRegistration.class);
        doReturn(serviceRegistration)
            .when(context).registerService(eq(clazz), notNull(clazz), notNull(Dictionary.class));
        
        return serviceRegistration;
    }
/**
     * Mock the {@link BundleContext#registerService(Class, Object, Dictionary)} method.
     * 
     * @param context
     *      context to stub
     * @param clazz
     *      type of service registration
     * @return
     *      registration for the service
     */
Mock the  BundleContext#registerService(Class, Object, Dictionary) method.

@param context
context to stub
@param clazz
type of service registration
@return
registration for the service
Mock the BundleContext#registerService ( Class Object Dictionary ) method . @param context context to stub @param clazz type of service registration @return registration for the service
@SuppressWarnings("unchecked")
    public static <T> ServiceRegistration<T> stubServiceRegistration(BundleContext context, Class<T> clazz)
    {
        ServiceRegistration<T> serviceRegistration = mock(ServiceRegistration.class);
        doReturn(serviceRegistration)
            .when(context).registerService(eq(clazz), notNull(clazz), notNull(Dictionary.class));
        return serviceRegistration;
    }
@ SuppressWarnings ( "unchecked" ) public static < T > ServiceRegistration < T > stubServiceRegistration ( BundleContext context , Class < T > clazz ) { ServiceRegistration < T > serviceRegistration = mock ( ServiceRegistration . class ) ; doReturn ( serviceRegistration ) . when ( context ) . registerService ( eq ( clazz ) , notNull ( clazz ) , notNull ( Dictionary . class ) ) ; return serviceRegistration ; }
Mock the {@link BundleContext#registerService(Class, Object, Dictionary)} method.
Mock the { @link BundleContext#registerService ( Class Object Dictionary ) } method .