WebSSOProfileConsumerConfigurer extends SecurityConfigurerAdapter<Void, ServiceProviderBuilder> { @Override public void configure(ServiceProviderBuilder builder) throws Exception { if (webSSOProfileConsumerBean == null) { if (webSSOProfileConsumer == null) { webSSOProfileConsumer = createWebSSOProfileConsumer(); } builder.setSharedObject(WebSSOProfileConsumer.class, webSSOProfileConsumer); } } WebSSOProfileConsumerConfigurer();  WebSSOProfileConsumerConfigurer(WebSSOProfileConsumer webSSOProfileConsumer); @Override void init(ServiceProviderBuilder builder); @Override void configure(ServiceProviderBuilder builder);  }
@Test public void configure() throws Exception { WebSSOProfileConsumerConfigurer configurer = spy(new WebSSOProfileConsumerConfigurer()); WebSSOProfileConsumer profile = mock(WebSSOProfileConsumer.class); when(configurer.createWebSSOProfileConsumer()).thenReturn(profile); configurer.init(builder); configurer.configure(builder); verify(builder).setSharedObject(eq(WebSSOProfileConsumer.class), eq(profile)); }