Upgraded Spring Boot from 1.3.7.RELEASE to 2.2.0.RELEASE
[facebook-errors] / src / test / java / de / juplo / facebook / errors / FacebookErrorsOAuth2AutoConfigurationTest.java
diff --git a/src/test/java/de/juplo/facebook/errors/FacebookErrorsOAuth2AutoConfigurationTest.java b/src/test/java/de/juplo/facebook/errors/FacebookErrorsOAuth2AutoConfigurationTest.java
deleted file mode 100644 (file)
index 7c1e156..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-package de.juplo.facebook.errors;
-
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import org.junit.After;
-import org.junit.Test;
-import org.springframework.context.annotation.Configuration;
-import static org.junit.Assert.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer;
-import org.springframework.boot.autoconfigure.security.oauth2.OAuth2AutoConfiguration;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.mock.env.MockEnvironment;
-import org.springframework.security.oauth2.client.OAuth2RestTemplate;
-import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
-
-
-
-public class FacebookErrorsOAuth2AutoConfigurationTest
-{
-  private final Logger LOG =
-      LoggerFactory.getLogger(FacebookErrorsOAuth2AutoConfigurationTest.class);
-
-
-  private ConfigurableApplicationContext context;
-
-
-  @After
-  public void tearDown()
-  {
-    if (this.context != null)
-      this.context.close();
-  }
-
-
-  @Test
-  public void defaultNonWebConfiguration()
-  {
-    LOG.info("<-- Start Of New Test-Case!");
-    Map<String, String> properties = new HashMap<>();
-    properties.put("security.oauth2.client.client-id", "CLIENT_ID");
-    context = loadNonWebApplicationContext(EmptyConfiguration.class, properties);
-    OAuth2RestTemplate template = context.getBean(OAuth2RestTemplate.class);
-    assertEquals(OAuth2GraphApiErrorHandler.class, template.getErrorHandler().getClass());
-  }
-
-  @Test
-  public void defaultWebConfiguration()
-  {
-    LOG.info("<-- Start Of New Test-Case!");
-    Map<String, String> properties = new HashMap<>();
-    properties.put("security.oauth2.client.client-id", "CLIENT_ID");
-    context = loadWebApplicationContext(EmptyConfiguration.class, properties);
-    OAuth2RestTemplate template = context.getBean(OAuth2RestTemplate.class);
-    assertEquals(OAuth2GraphApiErrorHandler.class, template.getErrorHandler().getClass());
-  }
-
-
-  @Configuration
-  static class EmptyConfiguration
-  {
-  }
-
-
-  private ConfigurableApplicationContext loadNonWebApplicationContext(
-      Class<?> config,
-      Map<String, String> properties
-      )
-  {
-    AnnotationConfigApplicationContext ctx =
-        new AnnotationConfigApplicationContext();
-    if (properties != null)
-    {
-      MockEnvironment env = new MockEnvironment();
-      for (Entry<String, String> entry : properties.entrySet())
-        env.withProperty(entry.getKey(), entry.getValue());
-      ctx.setEnvironment(env);
-    }
-    ctx.register(FacebookErrorsOAuth2AutoConfiguration.class);
-    ctx.register(OAuth2AutoConfiguration.class);
-    ctx.register(config);
-    AutoConfigurationReportLoggingInitializer report =
-        new AutoConfigurationReportLoggingInitializer();
-    report.initialize(ctx);
-    ctx.refresh();
-    return ctx;
-  }
-
-  private ConfigurableApplicationContext loadWebApplicationContext(
-      Class<?> config,
-      Map<String, String> properties
-      )
-  {
-    AnnotationConfigWebApplicationContext ctx =
-        new AnnotationConfigWebApplicationContext();
-    if (properties != null)
-    {
-      MockEnvironment env = new MockEnvironment();
-      for (Entry<String, String> entry : properties.entrySet())
-        env.withProperty(entry.getKey(), entry.getValue());
-      ctx.setEnvironment(env);
-    }
-    ctx.register(FacebookErrorsOAuth2AutoConfiguration.class);
-    ctx.register(OAuth2AutoConfiguration.class);
-    ctx.register(config);
-    AutoConfigurationReportLoggingInitializer report =
-        new AutoConfigurationReportLoggingInitializer();
-    report.initialize(ctx);
-    ctx.refresh();
-    return ctx;
-  }
-}