Updates test calls to remove trailing slash

This commit is contained in:
spencergibb
2022-07-07 16:55:47 -04:00
parent 106618ac64
commit 920d0151d1
9 changed files with 16 additions and 15 deletions

View File

@@ -67,7 +67,7 @@ public class BootstrapConfigServerIntegrationTests {
@Test
public void contextLoads() {
ResponseEntity<Environment> response = new TestRestTemplate().exchange(
"http://localhost:" + this.port + "/foo/development/", HttpMethod.GET, getV2AcceptEntity(),
"http://localhost:" + this.port + "/foo/development", HttpMethod.GET, getV2AcceptEntity(),
Environment.class);
Environment environment = response.getBody();
assertThat(environment.getPropertySources()).hasSize(2);

View File

@@ -70,7 +70,7 @@ public class CompositeIntegrationTests {
@Test
public void contextLoads() {
ResponseEntity<Environment> response = new TestRestTemplate().exchange(
"http://localhost:" + this.port + "/foo/development/", HttpMethod.GET, getV2AcceptEntity(),
"http://localhost:" + this.port + "/foo/development", HttpMethod.GET, getV2AcceptEntity(),
Environment.class);
Environment environment = response.getBody();
assertThat(3).isEqualTo(environment.getPropertySources().size());
@@ -121,7 +121,7 @@ public class CompositeIntegrationTests {
@Test
public void contextLoads() {
ResponseEntity<Environment> response = new TestRestTemplate().exchange(
"http://localhost:" + this.port + "/foo/development/", HttpMethod.GET, getV2AcceptEntity(),
"http://localhost:" + this.port + "/foo/development", HttpMethod.GET, getV2AcceptEntity(),
Environment.class);
Environment environment = response.getBody();
assertThat(environment.getPropertySources()).hasSize(3);

View File

@@ -64,7 +64,7 @@ public class ConfigClientBackwardsCompatibilityIntegrationTests {
@Test
public void testBackwardsCompatibleFormat() {
Map environment = new TestRestTemplate().getForObject("http://localhost:" + this.port + "/foo/development/",
Map environment = new TestRestTemplate().getForObject("http://localhost:" + this.port + "/foo/development",
Map.class);
Object value = getPropertySourceValue(environment);
assertThat(value).isInstanceOf(String.class).isEqualTo("true");
@@ -81,7 +81,7 @@ public class ConfigClientBackwardsCompatibilityIntegrationTests {
@Test
public void testNewFormat() {
ResponseEntity<Map> response = new TestRestTemplate().exchange(
"http://localhost:" + this.port + "/foo/development/", HttpMethod.GET, getV2AcceptEntity(), Map.class);
"http://localhost:" + this.port + "/foo/development", HttpMethod.GET, getV2AcceptEntity(), Map.class);
Object value = getPropertySourceValue(response.getBody());
assertThat(value).isInstanceOf(Map.class);
Map valueMap = Map.class.cast(value);
@@ -99,9 +99,10 @@ public class ConfigClientBackwardsCompatibilityIntegrationTests {
assertThat(valueMap).containsEntry("value", "true");
}
@SuppressWarnings({ "rawtypes", "unchecked" })
private Object getPropertySourceValue(Map environment) {
assertThat(environment).isNotNull();
assertThat(environment.containsKey("propertySources"));
assertThat(environment.containsKey("propertySources")).isTrue();
List propertySources = (List) environment.get("propertySources");
assertThat(propertySources).hasSizeGreaterThan(1);
Map source = (Map) propertySources.get(0);

View File

@@ -60,7 +60,7 @@ public class NativeConfigServerIntegrationTests {
@Test
public void contextLoads() {
ResponseEntity<Environment> response = new TestRestTemplate().exchange(
"http://localhost:" + this.port + "/foo/development/", HttpMethod.GET, getV2AcceptEntity(),
"http://localhost:" + this.port + "/foo/development", HttpMethod.GET, getV2AcceptEntity(),
Environment.class);
Environment environment = response.getBody();
assertThat(environment.getPropertySources().isEmpty()).isFalse();
@@ -83,7 +83,7 @@ public class NativeConfigServerIntegrationTests {
@Test
public void badYaml() {
ResponseEntity<String> response = new TestRestTemplate()
.getForEntity("http://localhost:" + this.port + "/bad/default/", String.class);
.getForEntity("http://localhost:" + this.port + "/bad/default", String.class);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
}

View File

@@ -94,7 +94,7 @@ public class RefreshableConfigServerIntegrationTests {
@Test
public void refreshOverrides() {
ResponseEntity<Environment> entity = new TestRestTemplate().exchange(
"http://localhost:" + this.port + "/foo/development/", HttpMethod.GET, getV2AcceptEntity(),
"http://localhost:" + this.port + "/foo/development", HttpMethod.GET, getV2AcceptEntity(),
Environment.class);
Environment environment = entity.getBody();
assertThat(environment.getPropertySources()).isEmpty();
@@ -111,7 +111,7 @@ public class RefreshableConfigServerIntegrationTests {
response = new TestRestTemplate().postForEntity(actuatorEndpoint + "/refresh", null, Void.class);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
entity = new TestRestTemplate().exchange("http://localhost:" + this.port + "/foo/development/", HttpMethod.GET,
entity = new TestRestTemplate().exchange("http://localhost:" + this.port + "/foo/development", HttpMethod.GET,
getV2AcceptEntity(), Environment.class);
environment = entity.getBody();
assertThat(environment.getPropertySources()).isNotEmpty();

View File

@@ -70,7 +70,7 @@ public class SubversionConfigServerIntegrationTests {
@Test
public void contextLoads() {
ResponseEntity<Environment> exchange = new TestRestTemplate().exchange(
"http://localhost:" + this.port + "/foo/development/", HttpMethod.GET, getV2AcceptEntity(),
"http://localhost:" + this.port + "/foo/development", HttpMethod.GET, getV2AcceptEntity(),
Environment.class);
Environment environment = exchange.getBody();
assertThat(environment.getPropertySources().isEmpty()).isFalse();

View File

@@ -65,7 +65,7 @@ public class VanillaConfigServerIntegrationTests {
@Test
public void contextLoads() {
ResponseEntity<Environment> response = new TestRestTemplate().exchange(
"http://localhost:" + this.port + "/foo/development/", HttpMethod.GET, getV2AcceptEntity(),
"http://localhost:" + this.port + "/foo/development", HttpMethod.GET, getV2AcceptEntity(),
Environment.class);
Environment environment = response.getBody();
assertThat(environment.getPropertySources().isEmpty()).isFalse();

View File

@@ -76,7 +76,7 @@ public class CustomCompositeEnvironmentRepositoryTests {
@Test
public void contextLoads() {
Environment environment = new TestRestTemplate()
.getForObject("http://localhost:" + this.port + "/foo/development/", Environment.class);
.getForObject("http://localhost:" + this.port + "/foo/development", Environment.class);
List<PropertySource> propertySources = environment.getPropertySources();
assertThat(3).isEqualTo(propertySources.size());
assertThat("overrides").isEqualTo(propertySources.get(0).getName());
@@ -128,7 +128,7 @@ public class CustomCompositeEnvironmentRepositoryTests {
@Test
public void contextLoads() {
Environment environment = new TestRestTemplate()
.getForObject("http://localhost:" + this.port + "/foo/development/", Environment.class);
.getForObject("http://localhost:" + this.port + "/foo/development", Environment.class);
List<PropertySource> propertySources = environment.getPropertySources();
assertThat(3).isEqualTo(propertySources.size());
assertThat("overrides").isEqualTo(propertySources.get(0).getName());

View File

@@ -54,7 +54,7 @@ public class CustomEnvironmentRepositoryTests {
@Test
public void contextLoads() {
Environment environment = new TestRestTemplate()
.getForObject("http://localhost:" + this.port + "/foo/development/", Environment.class);
.getForObject("http://localhost:" + this.port + "/foo/development", Environment.class);
assertThat(environment.getPropertySources().isEmpty()).isFalse();
}