@@ -72,8 +72,9 @@ public void testMaxPoolSize(TestContext context) throws InterruptedException {
72
72
73
73
final Queue <Connection > connectionSet = new LinkedList <>();
74
74
// Ask for 50 connections
75
- for (int i = 0 ; i < TEST_LENGTH ; i ++) {
75
+ for (int i = 0 ; i < TEST_LENGTH ; i ++) {
76
76
pool .take (result -> {
77
+ // We will decrease our CountDownLatch with each obtained connection
77
78
countDownLatch .countDown ();
78
79
context .assertTrue (result .succeeded ());
79
80
connectionSet .add (result .result ());
@@ -89,7 +90,7 @@ public void testMaxPoolSize(TestContext context) throws InterruptedException {
89
90
context .assertEquals (TEST_LENGTH - MAX_POOL_SIZE , (int )countDownLatch .getCount ()); // Counter should be 35
90
91
91
92
// We will give back the connections one by one. No new connections should be created
92
- for (int i = MAX_POOL_SIZE + 1 ; i <= TEST_LENGTH ; i ++) {
93
+ for (int i = MAX_POOL_SIZE + 1 ; i <= TEST_LENGTH ; i ++) {
93
94
pool .giveBack (connectionSet .poll ());
94
95
context .assertEquals (MAX_POOL_SIZE , pool .connectionAttempts );
95
96
context .assertEquals (MAX_POOL_SIZE , pool .createdConnections );
@@ -136,7 +137,7 @@ public void testRetriesAndFail(TestContext context) {
136
137
context .assertEquals (MAX_RETRIES + 1 , pool .connectionAttempts );
137
138
context .assertEquals (0 , pool .createdConnections );
138
139
139
- // Verify the the Vert.x timer has been used 5 times (MAX_RETRIES
140
+ // Verify the the Vert.x timer has been used 5 times (MAX_RETRIES)
140
141
Mockito .verify (vertx , Mockito .times (MAX_RETRIES )).setTimer (Mockito .eq (100L ), Mockito .any ());
141
142
Mockito .verifyNoMoreInteractions (vertx );
142
143
@@ -171,7 +172,7 @@ public void testRetriesAndSuccess(TestContext context) {
171
172
context .assertEquals (MAX_RETRIES + 1 , pool .connectionAttempts );
172
173
context .assertEquals (1 , pool .createdConnections );
173
174
174
- // Verify the the Vert.x timer has been used 5 times (MAX_RETRIES
175
+ // Verify the the Vert.x timer has been used 5 times (MAX_RETRIES)
175
176
Mockito .verify (vertx , Mockito .times (MAX_RETRIES )).setTimer (Mockito .eq (100L ), Mockito .any ());
176
177
async .complete ();
177
178
});
0 commit comments