Skip to content

Commit 7b04cdd

Browse files
committed
Polish "Prevent redis pool to initialize in unit test"
See gh-43774
1 parent 911a9a1 commit 7b04cdd

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/redis/RedisAutoConfigurationJedisTests.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -159,11 +159,13 @@ void testRedisConfigurationWithPool() {
159159
.run((context) -> {
160160
JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class);
161161
assertThat(cf.getHostName()).isEqualTo("foo");
162-
assertThat(cf.getPoolConfig().getMinIdle()).isZero();
163-
assertThat(cf.getPoolConfig().getMaxIdle()).isEqualTo(4);
164-
assertThat(cf.getPoolConfig().getMaxTotal()).isEqualTo(16);
165-
assertThat(cf.getPoolConfig().getMaxWaitDuration()).isEqualTo(Duration.ofSeconds(2));
166-
assertThat(cf.getPoolConfig().getDurationBetweenEvictionRuns()).isEqualTo(Duration.ofSeconds(30));
162+
assertThat(cf.getPoolConfig()).satisfies((poolConfig) -> {
163+
assertThat(poolConfig.getMinIdle()).isEqualTo(0);
164+
assertThat(poolConfig.getMaxIdle()).isEqualTo(4);
165+
assertThat(poolConfig.getMaxTotal()).isEqualTo(16);
166+
assertThat(poolConfig.getMaxWaitDuration()).isEqualTo(Duration.ofSeconds(2));
167+
assertThat(poolConfig.getDurationBetweenEvictionRuns()).isEqualTo(Duration.ofSeconds(30));
168+
});
167169
});
168170
}
169171

0 commit comments

Comments
 (0)