// Path: spring-cloud-services-spring-connector/src/test/java/io/pivotal/spring/cloud/MockCloudConnector.java
// public class MockCloudConnector implements CloudConnector {
// 
// 	public static final CloudConnector instance = Mockito.mock(CloudConnector.class);
// 
// 	public static void reset() {
// 		Mockito.reset(instance);
// 	}
// 
// 	public boolean isInMatchingCloud() {
// 		return instance.isInMatchingCloud();
// 	}
// 
// 	public ApplicationInstanceInfo getApplicationInstanceInfo() {
// 		return instance.getApplicationInstanceInfo();
// 	}
// 
// 	public List<ServiceInfo> getServiceInfos() {
// 		return instance.getServiceInfos();
// 	}
// }
// 
// Path: spring-cloud-services-connector-core/src/main/java/io/pivotal/spring/cloud/service/common/EurekaServiceInfo.java
// @ServiceInfo.ServiceLabel("eureka")
// public class EurekaServiceInfo extends UriBasedServiceInfo {
// 	private String clientId;
// 	private String clientSecret;
// 	private String accessTokenUri;
// 
// 	public EurekaServiceInfo(String id, String uriString, String clientId, String clientSecret, String accessTokenUri) {
// 		super(id, uriString);
// 		this.clientId = clientId;
// 		this.clientSecret = clientSecret;
// 		this.accessTokenUri = accessTokenUri;
// 	}
// 
// 	public String getClientId() {
// 		return clientId;
// 	}
// 
// 	public String getClientSecret() {
// 		return clientSecret;
// 	}
// 
// 	public String getAccessTokenUri() {
// 		return accessTokenUri;
// 	}
// 
// }
// 
// Path: spring-cloud-services-spring-connector/src/main/java/io/pivotal/spring/cloud/config/java/ServiceInfoPropertySourceAdapter.java
// public static final String SPRING_AUTOCONFIGURE_EXCLUDE = "spring.autoconfigure.exclude";


import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static io.pivotal.spring.cloud.config.java.ServiceInfoPropertySourceAdapter.SPRING_AUTOCONFIGURE_EXCLUDE;
import static org.junit.Assert.assertEquals;
import java.util.Collections;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import io.pivotal.spring.cloud.MockCloudConnector;
import io.pivotal.spring.cloud.service.common.EurekaServiceInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.env.Environment;
	@Autowired
	private Environment environment;

	@BeforeClass
	public static void beforeClass() {
		Mockito.when(MockCloudConnector.instance.isInMatchingCloud()).thenReturn(true);
		Mockito.when(MockCloudConnector.instance.getServiceInfos()).thenReturn(Collections.singletonList(
				new EurekaServiceInfo("eureka", URI, CLIENT_ID, CLIENT_SECRET, ACCESS_TOKEN_URI)));
	}

	@AfterClass
	public static void afterClass() {
		MockCloudConnector.reset();
	}

	@TestPropertySource(properties = "spring.rabbitmq.host=some_rabbit_host")
	public static class WithRabbitBinding extends EurekaServiceConnectorIntegrationTest {

		@Test
		public void springAutoConfigureExcludeIsNull() {
			assertPropertyEquals(null, SPRING_AUTOCONFIGURE_EXCLUDE);
		}

	}

	public static class WithoutRabbitBinding extends EurekaServiceConnectorIntegrationTest {

		@Test
		public void springAutoConfigureExcludeIsOnlyRabbitAutoConfig() {
			assertPropertyEquals("org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration",
// Path: spring-cloud-services-spring-connector/src/test/java/io/pivotal/spring/cloud/MockCloudConnector.java
// public class MockCloudConnector implements CloudConnector {
// 
// 	public static final CloudConnector instance = Mockito.mock(CloudConnector.class);
// 
// 	public static void reset() {
// 		Mockito.reset(instance);
// 	}
// 
// 	public boolean isInMatchingCloud() {
// 		return instance.isInMatchingCloud();
// 	}
// 
// 	public ApplicationInstanceInfo getApplicationInstanceInfo() {
// 		return instance.getApplicationInstanceInfo();
// 	}
// 
// 	public List<ServiceInfo> getServiceInfos() {
// 		return instance.getServiceInfos();
// 	}
// }
// 
// Path: spring-cloud-services-connector-core/src/main/java/io/pivotal/spring/cloud/service/common/EurekaServiceInfo.java
// @ServiceInfo.ServiceLabel("eureka")
// public class EurekaServiceInfo extends UriBasedServiceInfo {
// 	private String clientId;
// 	private String clientSecret;
// 	private String accessTokenUri;
// 
// 	public EurekaServiceInfo(String id, String uriString, String clientId, String clientSecret, String accessTokenUri) {
// 		super(id, uriString);
// 		this.clientId = clientId;
// 		this.clientSecret = clientSecret;
// 		this.accessTokenUri = accessTokenUri;
// 	}
// 
// 	public String getClientId() {
// 		return clientId;
// 	}
// 
// 	public String getClientSecret() {
// 		return clientSecret;
// 	}
// 
// 	public String getAccessTokenUri() {
// 		return accessTokenUri;
// 	}
// 
// }
// 
// Path: spring-cloud-services-spring-connector/src/main/java/io/pivotal/spring/cloud/config/java/ServiceInfoPropertySourceAdapter.java
// public static final String SPRING_AUTOCONFIGURE_EXCLUDE = "spring.autoconfigure.exclude";


// Path: spring-cloud-services-spring-connector/src/test/java/io/pivotal/spring/cloud/service/eureka/EurekaServiceConnectorIntegrationTest.java
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static io.pivotal.spring.cloud.config.java.ServiceInfoPropertySourceAdapter.SPRING_AUTOCONFIGURE_EXCLUDE;
import static org.junit.Assert.assertEquals;
import java.util.Collections;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import io.pivotal.spring.cloud.MockCloudConnector;
import io.pivotal.spring.cloud.service.common.EurekaServiceInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.env.Environment;

	@Autowired
	private Environment environment;

	@BeforeClass
	public static void beforeClass() {
		Mockito.when(MockCloudConnector.instance.isInMatchingCloud()).thenReturn(true);
		Mockito.when(MockCloudConnector.instance.getServiceInfos()).thenReturn(Collections.singletonList(
				new EurekaServiceInfo("eureka", URI, CLIENT_ID, CLIENT_SECRET, ACCESS_TOKEN_URI)));
	}

	@AfterClass
	public static void afterClass() {
		MockCloudConnector.reset();
	}

	@TestPropertySource(properties = "spring.rabbitmq.host=some_rabbit_host")
	public static class WithRabbitBinding extends EurekaServiceConnectorIntegrationTest {

		@Test
		public void springAutoConfigureExcludeIsNull() {
			assertPropertyEquals(null, SPRING_AUTOCONFIGURE_EXCLUDE);
		}

	}

	public static class WithoutRabbitBinding extends EurekaServiceConnectorIntegrationTest {

		@Test
		public void springAutoConfigureExcludeIsOnlyRabbitAutoConfig() {
			assertPropertyEquals("org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration",
					SPRING_AUTOCONFIGURE_EXCLUDE);