Skip to content

Commit 6ad045b

Browse files
authored
Update CommonsPool2ConfigConverterUnitTests.java (#3147)
* Update CommonsPool2ConfigConverterUnitTests.java Improves the readability of the test. Numeric literals in assertions have been replaced with descriptive constants, improving readability and making the test easier to understand, modify, and debugging efficiency. * style: apply Maven code formatting
1 parent 319e315 commit 6ad045b

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/test/java/io/lettuce/core/support/CommonsPool2ConfigConverterUnitTests.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,27 @@
1919
@Tag(UNIT_TEST)
2020
class CommonsPool2ConfigConverterUnitTests {
2121

22+
private static final int MIN_IDLE_EXPECTED = 2;
23+
24+
private static final int MAX_IDLE_EXPECTED = 12;
25+
26+
private static final int MAX_TOTAL_EXPECTED = 13;
27+
2228
@Test
2329
void shouldAdaptConfiguration() {
24-
2530
GenericObjectPoolConfig<String> config = new GenericObjectPoolConfig<>();
26-
config.setMinIdle(2);
27-
config.setMaxIdle(12);
28-
config.setMaxTotal(13);
31+
config.setMinIdle(MIN_IDLE_EXPECTED);
32+
config.setMaxIdle(MAX_IDLE_EXPECTED);
33+
config.setMaxTotal(MAX_TOTAL_EXPECTED);
2934
config.setTestOnBorrow(true);
3035
config.setTestOnReturn(true);
3136
config.setTestOnCreate(true);
3237

3338
BoundedPoolConfig result = CommonsPool2ConfigConverter.bounded(config);
3439

35-
assertThat(result.getMinIdle()).isEqualTo(2);
36-
assertThat(result.getMaxIdle()).isEqualTo(12);
37-
assertThat(result.getMaxTotal()).isEqualTo(13);
40+
assertThat(result.getMinIdle()).isEqualTo(MIN_IDLE_EXPECTED);
41+
assertThat(result.getMaxIdle()).isEqualTo(MAX_IDLE_EXPECTED);
42+
assertThat(result.getMaxTotal()).isEqualTo(MAX_TOTAL_EXPECTED);
3843
assertThat(result.isTestOnAcquire()).isTrue();
3944
assertThat(result.isTestOnCreate()).isTrue();
4045
assertThat(result.isTestOnRelease()).isTrue();

0 commit comments

Comments
 (0)