@SuppressWarnings( { "rawtypes", "unchecked" } )
@Test
public void testRegisterConsumerFactory() throws AuthenticationConsumptionException, AuthenticationFactoryException {
AuthenticationConsumer<Object, KerberosAuthenticationProvider> authConsumer = mock( AuthenticationConsumer.class );
AuthenticationConsumerFactory<Object, AuthenticationConsumer, KerberosAuthenticationProvider> factory =
mock( AuthenticationConsumerFactory.class );
when( factory.getReturnType() ).thenReturn( Object.class );
when( factory.getCreateArgType() ).thenReturn( AuthenticationConsumer.class );
when( factory.getConsumedType() ).thenReturn( KerberosAuthenticationProvider.class );
when( factory.create( authConsumer ) ).thenReturn( authConsumer );
KerberosAuthenticationProvider kerberosAuthenticationProvider =
new KerberosAuthenticationProvider( "kerb", "kerb", true, "pass", true, "none" );
manager.registerAuthenticationProvider( kerberosAuthenticationProvider );
manager.registerConsumerFactory( factory );
manager.getAuthenticationPerformer( Object.class, AuthenticationConsumer.class,
kerberosAuthenticationProvider.getId() ).perform( authConsumer );
verify( authConsumer ).consume( kerberosAuthenticationProvider );
}