package com.kakawait.spring.boot.security.cas;


import org.junit.After;
import org.junit.Test;
import org.springframework.boot.autoconfigure.security.SecurityFilterAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.PropertiesPropertySource;
import org.springframework.mock.web.MockServletContext;
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
import org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;

import java.util.Properties;

/**
 * @author Thibaud Leprêtre
 */
public class CasSecurityAutoConfigurationTest {

    private ConfigurableApplicationContext context;

    @After
    public void tearDown() {
        if (this.context != null) {
            this.context.close();
        }
    }

    @Test
    public void test() {
        load(EmptyConfiguration.class);
    }

    @Configuration
    static class EmptyConfiguration {
    }

    private void load(Class<?>... configs) {
        Properties properties = new Properties();
        properties.put("security.cas.server.base-url", "http://localhost:8888/cas");

        load(properties, configs);
    }

    private void load(Properties properties, Class<?>... configs) {
        Class[] securityConfigurationsClasses = {SecurityFilterAutoConfiguration.class,
                ObjectPostProcessorConfiguration.class, AuthenticationConfiguration.class};

        AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
        context.getEnvironment().getPropertySources().addFirst(new PropertiesPropertySource("test", properties));
        context.register(configs);
        context.register(securityConfigurationsClasses);
        context.register(CasSecurityAutoConfiguration.class);
        context.setServletContext(new MockServletContext());
        context.refresh();
        this.context = context;
    }
}

@@ -42,16 +42,359 @@
 .cas;%0A%0A%0A
+import com.kakawait.spring.security.cas.client.ticket.AttributePrincipalProxyTicketProvider;%0Aimport com.kakawait.spring.security.cas.client.ticket.ProxyTicketProvider;%0Aimport com.kakawait.spring.security.cas.client.validation.AssertionProvider;%0Aimport com.kakawait.spring.security.cas.client.validation.SecurityContextHolderAssertionProvider;%0A
 import o
@@ -405,24 +405,24 @@
 unit.After;%0A
-
 import org.j
@@ -1097,16 +1097,75 @@
 rties;%0A%0A
+import static org.assertj.core.api.Assertions.assertThat;%0A%0A
 /**%0A * @
@@ -1451,48 +1451,539 @@
 oid 
-test() %7B%0A        load(EmptyConfiguration
+autoConfiguration_EmptyConfiguration_SecurityContextHolderAssertionProviderBean() %7B%0A        load(EmptyConfiguration.class);%0A        assertThat(context.getBean(AssertionProvider.class)).isInstanceOf(SecurityContextHolderAssertionProvider.class);%0A    %7D%0A%0A    @Test%0A    public void autoConfiguration_EmptyConfiguration_AttributePrincipalProxyTicketProviderBean() %7B%0A        load(EmptyConfiguration.class);%0A        assertThat(context.getBean(ProxyTicketProvider.class))%0A                .isInstanceOf(AttributePrincipalProxyTicketProvider
 .cla

Add autoconfiguration part tests