From 0dafccb5e8e5a9b60f4ad8fbbd7b83ac51e152ea Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Thu, 16 Nov 2017 22:22:12 -0500 Subject: [PATCH] Fix test for bot 2.0 --- ...RegistrationCustomizedServletContextTests.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/spring-cloud-consul-discovery/src/test/java/org/springframework/cloud/consul/serviceregistry/ConsulAutoServiceRegistrationCustomizedServletContextTests.java b/spring-cloud-consul-discovery/src/test/java/org/springframework/cloud/consul/serviceregistry/ConsulAutoServiceRegistrationCustomizedServletContextTests.java index 83e7970d..0240e01f 100644 --- a/spring-cloud-consul-discovery/src/test/java/org/springframework/cloud/consul/serviceregistry/ConsulAutoServiceRegistrationCustomizedServletContextTests.java +++ b/spring-cloud-consul-discovery/src/test/java/org/springframework/cloud/consul/serviceregistry/ConsulAutoServiceRegistrationCustomizedServletContextTests.java @@ -31,10 +31,7 @@ import com.ecwid.consul.v1.ConsulClient; import com.ecwid.consul.v1.Response; import com.ecwid.consul.v1.agent.model.Service; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.assertj.core.api.Assertions.assertThat; import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; /** @@ -44,7 +41,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen @SpringBootTest(classes = ConsulAutoServiceRegistrationCustomizedServletContextTests.TestConfig.class, properties = { "spring.application.name=myTestService-WithServletContext", "spring.cloud.consul.discovery.instanceId=myTestService1-WithServletContext", - "server.contextPath=/customContext"}, + "server.servlet.context-path=/customContext"}, webEnvironment = RANDOM_PORT) public class ConsulAutoServiceRegistrationCustomizedServletContextTests { @@ -56,10 +53,10 @@ public class ConsulAutoServiceRegistrationCustomizedServletContextTests { Response> response = consul.getAgentServices(); Map services = response.getValue(); Service service = services.get("myTestService1-WithServletContext"); - assertNotNull("service was null", service); - assertNotEquals("service port is 0", 0, service.getPort().intValue()); - assertEquals("service id was wrong", "myTestService1-WithServletContext", service.getId()); - assertTrue("service context was wrong", service.getTags().contains("contextPath=/customContext")); + assertThat(service).as("service was null").isNotNull(); + assertThat(service.getPort().intValue()).as("service port is 0").isNotEqualTo(0); + assertThat(service.getId()).as("service id was wrong").isEqualTo("myTestService1-WithServletContext"); + assertThat(service.getTags()).as("contextPath tag missing").contains("contextPath=/customContext"); } @EnableDiscoveryClient