Skip to content

Commit 225382f

Browse files
committed
Fix resolveProfileSpecificReturnsProfileSpecificFiles test to success
1 parent eab2b45 commit 225382f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/StandardConfigDataLocationResolverTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
* @author Madhura Bhave
4545
* @author Phillip Webb
4646
* @author Moritz Halbritter
47+
* @author Sijun Yang
4748
*/
4849
class StandardConfigDataLocationResolverTests {
4950

@@ -254,8 +255,8 @@ void resolveWhenLocationUsesOptionalExtensionSyntaxResolves() throws Exception {
254255
@Test
255256
void resolveProfileSpecificReturnsProfileSpecificFiles() {
256257
ConfigDataLocation location = ConfigDataLocation.of("classpath:/configdata/properties/");
257-
Profiles profiles = mock(Profiles.class);
258-
given(profiles.iterator()).willReturn(Collections.singletonList("dev").iterator());
258+
this.environment.setActiveProfiles("dev");
259+
Profiles profiles = new Profiles(this.environment, this.environmentBinder, Collections.emptyList());
259260
List<StandardConfigDataResource> locations = this.resolver.resolveProfileSpecific(this.context, location,
260261
profiles);
261262
assertThat(locations).hasSize(1);

0 commit comments

Comments
 (0)