package org.springframework.cloud.bootstrap;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.bootstrap.BootstrapOrderingSpringApplicationJsonIntegrationTests.Application;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.test.context.junit4.SpringRunner;

import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.cloud.bootstrap.TestHigherPriorityBootstrapConfiguration.firstToBeCreated;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
public class BootstrapSourcesOrderingTests {

	@Autowired
	private ConfigurableEnvironment environment;

	@Test
	public void sourcesAreOrderedCorrectly() {
		Class<?> firstConstructedClass = firstToBeCreated.get();
		assertThat(firstConstructedClass).as("bootstrap sources not ordered correctly").isEqualTo(TestHigherPriorityBootstrapConfiguration.class);
	}

	@EnableAutoConfiguration
	@Configuration
	protected static class Application {
	}

}

@@ -39,16 +39,41 @@
 strap;%0A%0A
+import org.junit.Assert;%0A
 import o
@@ -295,30 +295,38 @@
 est.
-context.SpringBootTest
+SpringApplicationConfiguration
 ;%0Aim
@@ -613,74 +613,27 @@
 ring
-Runner;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat;
+JUnit4ClassRunner;%0A
 %0Aimp
@@ -754,16 +754,27 @@
 h(Spring
+JUnit4Class
 Runner.c
@@ -790,16 +790,32 @@
 ring
-BootTest
+ApplicationConfiguration
 (cla
@@ -1061,43 +1061,26 @@
 ;%0A%09%09
-a
+A
 ssert
-That(firstConstructedClass).a
+.assertEqual
 s(%22b
@@ -1122,20 +1122,14 @@
 tly%22
-).isEqualTo(
+,%0A%09%09%09%09
 Test
@@ -1170,16 +1170,39 @@
 on.class
+, firstConstructedClass
 );%0A%09%7D%0A%0A%09

fix tests for boot 1.4.x