SAMLContextProviderConfigurer extends SecurityConfigurerAdapter<Void, ServiceProviderBuilder> { @Override public void configure(ServiceProviderBuilder builder) throws Exception { SAMLContextProvider samlContextProviderBean = builder.getSharedObject(SAMLContextProvider.class); if (samlContextProviderBean == null && !samlContextProviderProperties.getLb().isEnabled()) { if (samlContextProvider == null) { samlContextProvider = createDefaultSamlContextProvider(); } builder.setSharedObject(SAMLContextProvider.class, samlContextProvider); } } SAMLContextProviderConfigurer(SAMLContextProvider samlContextProvider);  SAMLContextProviderConfigurer(); @Override void init(ServiceProviderBuilder builder); @Override void configure(ServiceProviderBuilder builder);  }
@Test public void configure() throws Exception { SAMLContextProviderConfigurer configurer = spy(new SAMLContextProviderConfigurer()); SAMLContextProvider provider = mock(SAMLContextProvider.class); when(configurer.createDefaultSamlContextProvider()).thenReturn(provider); configurer.init(builder); configurer.configure(builder); verify(builder).setSharedObject(eq(SAMLContextProvider.class), eq(provider)); }