From b0c26d296f9ef0d17626b4610c78045a40f37459 Mon Sep 17 00:00:00 2001 From: spencergibb Date: Tue, 8 Sep 2020 17:13:47 -0400 Subject: [PATCH] Updates test to deal with `configService` property source. --- .../ConfigServicePropertySourceLocatorTests.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/spring-cloud-config-client/src/test/java/org/springframework/cloud/config/client/ConfigServicePropertySourceLocatorTests.java b/spring-cloud-config-client/src/test/java/org/springframework/cloud/config/client/ConfigServicePropertySourceLocatorTests.java index 8b1da437..03538950 100644 --- a/spring-cloud-config-client/src/test/java/org/springframework/cloud/config/client/ConfigServicePropertySourceLocatorTests.java +++ b/spring-cloud-config-client/src/test/java/org/springframework/cloud/config/client/ConfigServicePropertySourceLocatorTests.java @@ -18,10 +18,12 @@ package org.springframework.cloud.config.client; import java.io.ByteArrayInputStream; import java.net.URI; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import org.hamcrest.core.IsInstanceOf; @@ -344,11 +346,10 @@ public class ConfigServicePropertySourceLocatorTests { mockRequestResponseWithoutLabel(new ResponseEntity<>(body, HttpStatus.OK)); this.locator.setRestTemplate(this.restTemplate); - Collection> propertySources = this.locator - .locateCollection(this.environment); - assertThat(propertySources).hasSize(1); - org.springframework.core.env.PropertySource propertySource = propertySources - .iterator().next(); + List> propertySources = new ArrayList<>(this.locator + .locateCollection(this.environment)); + assertThat(propertySources).hasSize(2); + org.springframework.core.env.PropertySource propertySource = propertySources.get(1); Map source = (Map) propertySource.getSource(); Iterator iterator = source.keySet().iterator(); assertThat(iterator.next()).isEqualTo("zuul.routes.specificproduct.path");