Skip to content

Commit dfd9f37

Browse files
committed
fix : fix tests
1 parent fb35c55 commit dfd9f37

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/test/java/org/alxkm/patterns/objectpool/ConcurrentObjectPoolTest.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class ConcurrentObjectPoolTest {
2222
private ConcurrentObjectPool<ConcurrentObjectPool.PoolableResource> pool;
2323
private AtomicInteger resourceIdGenerator;
2424

25-
//@BeforeEach
25+
@BeforeEach
2626
public void setUp() {
2727
resourceIdGenerator = new AtomicInteger(0);
2828
pool = new ConcurrentObjectPool<>(
@@ -32,14 +32,14 @@ public void setUp() {
3232
);
3333
}
3434

35-
//@AfterEach
35+
@AfterEach
3636
public void tearDown() {
3737
if (pool != null) {
3838
pool.shutdown();
3939
}
4040
}
4141

42-
//@Test
42+
@Test
4343
public void testBasicAcquireAndRelease() {
4444
ConcurrentObjectPool.PoolableResource resource = pool.acquire();
4545

@@ -51,14 +51,14 @@ public void testBasicAcquireAndRelease() {
5151
assertEquals(0, pool.getLeasedObjectsCount());
5252
}
5353

54-
//@Test
54+
@Test
5555
public void testPoolInitialization() {
5656
assertTrue(pool.getCurrentPoolSize() > 0, "Pool should be pre-populated");
5757
assertEquals(5, pool.getMaxPoolSize());
5858
assertEquals(0, pool.getLeasedObjectsCount());
5959
}
6060

61-
//@Test
61+
@Test
6262
public void testAcquireWithTimeout() {
6363
// Fill up the pool
6464
ConcurrentObjectPool.PoolableResource[] resources =
@@ -89,7 +89,7 @@ public void testAcquireWithTimeout() {
8989
pool.release(resource);
9090
}
9191

92-
//@Test
92+
@Test
9393
public void testConcurrentAcquireRelease() throws InterruptedException {
9494
final int threadCount = 10;
9595
final int operationsPerThread = 20;
@@ -135,7 +135,7 @@ public void testConcurrentAcquireRelease() throws InterruptedException {
135135
assertTrue(executor.awaitTermination(1, TimeUnit.SECONDS));
136136
}
137137

138-
//@Test
138+
@Test
139139
public void testObjectValidation() {
140140
// Create pool with custom validator that rejects objects with even IDs
141141
ConcurrentObjectPool<ConcurrentObjectPool.PoolableResource> customPool =
@@ -190,7 +190,7 @@ public void testPoolExhaustion() {
190190
stringPool.shutdown();
191191
}
192192

193-
//@Test
193+
@Test
194194
public void testInvalidObjectHandling() {
195195
ConcurrentObjectPool.PoolableResource resource = pool.acquire();
196196
assertNotNull(resource);
@@ -203,13 +203,13 @@ public void testInvalidObjectHandling() {
203203
assertEquals(0, pool.getLeasedObjectsCount());
204204
}
205205

206-
//@Test
206+
@Test
207207
public void testNullObjectHandling() {
208208
pool.release(null); // Should not cause any issues
209209
assertEquals(0, pool.getLeasedObjectsCount());
210210
}
211211

212-
//@Test
212+
@Test
213213
public void testStatistics() {
214214
int initialCreatedCount = pool.getTotalCreatedObjects();
215215
assertTrue(initialCreatedCount > 0, "Should have created initial objects");
@@ -227,7 +227,7 @@ public void testStatistics() {
227227
assertEquals(0, pool.getLeasedObjectsCount());
228228
}
229229

230-
//@Test
230+
@Test
231231
public void testResourceUsage() {
232232
ConcurrentObjectPool.PoolableResource resource = pool.acquire();
233233
assertNotNull(resource);
@@ -240,7 +240,7 @@ public void testResourceUsage() {
240240
assertFalse(resource.isInUse()); // Should be reset by validator
241241
}
242242

243-
//@Test
243+
@Test
244244
public void testConcurrentPoolOperations() throws InterruptedException {
245245
final int threadCount = 20;
246246
final CountDownLatch startLatch = new CountDownLatch(1);
@@ -272,7 +272,7 @@ public void testConcurrentPoolOperations() throws InterruptedException {
272272
assertNull(exceptionRef.get(), "No exceptions should occur during concurrent operations");
273273
}
274274

275-
//@Test
275+
@Test
276276
public void testPoolShutdown() {
277277
assertTrue(pool.getCurrentPoolSize() > 0);
278278

@@ -281,7 +281,7 @@ public void testPoolShutdown() {
281281
assertEquals(0, pool.getLeasedObjectsCount());
282282
}
283283

284-
//@Test
284+
@Test
285285
public void testConstructorValidation() {
286286
assertThrows(IllegalArgumentException.class, () -> {
287287
new ConcurrentObjectPool<>(null, 5);
@@ -296,7 +296,7 @@ public void testConstructorValidation() {
296296
});
297297
}
298298

299-
//@Test
299+
@Test
300300
public void testLongRunningStressTest() throws InterruptedException {
301301
final int threadCount = 8;
302302
final int duration = 1000; // 1 second

0 commit comments

Comments
 (0)