AuthenticationProvider anotherProvider = mock(AuthenticationProvider.class);
when(broker.getAuthenticationProviders()).thenReturn(Collections.singleton(anotherProvider));
QpidServiceLoader<AuthenticationManagerFactory> loader = mock(QpidServiceLoader.class);
AuthenticationManagerFactory managerFactory = mock(AuthenticationManagerFactory.class);
when(managerFactory.createInstance(any(Broker.class), any(Map.class))).thenReturn(mock(AuthenticationManager.class));
when(loader.atLeastOneInstanceOf(AuthenticationManagerFactory.class)).thenReturn(Collections.singleton(managerFactory));
AuthenticationProviderFactory providerFactory = new AuthenticationProviderFactory(loader);
UUID id = UUID.randomUUID();
AuthenticationProvider provider = providerFactory.create(id, broker, new HashMap<String, Object>());