Files
spring-cloud-core-tests/configserver-eureka/src/test/java/demo/ConfigServerEurekaApplicationTests.java
2017-07-05 08:45:41 -07:00

35 lines
1.1 KiB
Java

package demo;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EurekaDiscoveryClient;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
@DirtiesContext
public class ConfigServerEurekaApplicationTests {
@Autowired
DiscoveryClient discoveryClient;
@Test
public void contextLoads() {
}
@Test
public void discoveryClientIsEureka() {
assertTrue("discoveryClient is wrong type", discoveryClient instanceof CompositeDiscoveryClient);
assertTrue("composite discovery client should have a Eureka client with higher precendence"
, ((CompositeDiscoveryClient)discoveryClient).getDiscoveryClients().get(0) instanceof EurekaDiscoveryClient);
}
}