This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/turbine-fulcrum-pool.git

commit a8f6567bf97901e3fa40610091ac6473acfb4c6f
Author: Thomas Vandahl <[email protected]>
AuthorDate: Mon Jan 12 20:28:57 2026 +0100

    Add test with non-default constructor
---
 .../org/apache/fulcrum/pool/PoolServiceTest.java   | 64 +++++++++-------------
 1 file changed, 25 insertions(+), 39 deletions(-)

diff --git a/src/test/org/apache/fulcrum/pool/PoolServiceTest.java 
b/src/test/org/apache/fulcrum/pool/PoolServiceTest.java
index bd080de..d0e59e6 100644
--- a/src/test/org/apache/fulcrum/pool/PoolServiceTest.java
+++ b/src/test/org/apache/fulcrum/pool/PoolServiceTest.java
@@ -2,27 +2,7 @@ package org.apache.fulcrum.pool;
 
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
 
 import org.apache.fulcrum.testcontainer.BaseUnit5Test;
 import org.junit.jupiter.api.BeforeEach;
@@ -37,18 +17,18 @@ import org.junit.jupiter.api.Test;
  * @author <a href="mailto:[email protected]";>Stephen McConnell</a>
  *
  */
-public class PoolServiceTest extends BaseUnit5Test 
+public class PoolServiceTest extends BaseUnit5Test
 {
        /** Default pool service **/
        private PoolService poolService = null;
 
        /**
         * Perform pool service setup
-        * 
+        *
         * @throws Exception generic exception
         */
        @BeforeEach
-       public void setUp() throws Exception 
+       public void setUp() throws Exception
        {
         setConfigurationFileName("src/test/TestComponentConfig.xml");
         setRoleFileName("src/test/TestRoleConfig.xml");
@@ -57,22 +37,28 @@ public class PoolServiceTest extends BaseUnit5Test
 
        /**
         * Class to test for Object getInstance(Class)
-        * 
+        *
         * @throws PoolException generic exception
         */
        @Test
-       public void testGetInstanceClass() throws PoolException 
+       public void testGetInstanceClass() throws PoolException
        {
-               Object object = poolService.getInstance(StringBuilder.class);
-               assertTrue(object instanceof StringBuilder);
-
+        Object object1 = poolService.getInstance(StringBuilder.class);
+        assertInstanceOf(StringBuilder.class, object1);
+
+        String sourceValue = "testing";
+        Object params[] = new Object[] { sourceValue };
+        String signature[] = new String[] { "java.lang.String" };
+        Object object2 = poolService.getInstance(StringBuilder.class, params, 
signature);
+        assertInstanceOf(StringBuilder.class, object2);
+        assertEquals(sourceValue, object2.toString());
        }
 
        /**
         * Test adding an instance to the pool
         */
        @Test
-       public void testPutInstance() 
+       public void testPutInstance()
        {
                String s = "I am a string";
                assertEquals(0, poolService.getSize("java.lang.String"));
@@ -85,7 +71,7 @@ public class PoolServiceTest extends BaseUnit5Test
         * Test altering pool capacity
         */
        @Test
-       public void testGetSetCapacity() 
+       public void testGetSetCapacity()
        {
                assertEquals(128, poolService.getCapacity("java.lang.String"));
                poolService.setCapacity("java.lang.String", 278);
@@ -97,7 +83,7 @@ public class PoolServiceTest extends BaseUnit5Test
         * Test to determine current size of the pool
         */
        @Test
-       public void testGetSize() 
+       public void testGetSize()
        {
                String s = "I am a string";
                assertEquals(0, poolService.getSize("java.lang.String"));
@@ -110,14 +96,14 @@ public class PoolServiceTest extends BaseUnit5Test
         * Class to test for void clearPool(String)
         */
        @Test
-       public void testClearPoolString() 
+       public void testClearPoolString()
        {
                String s = "I am a string";
                assertEquals(0, poolService.getSize("java.lang.String"));
-               
+
                poolService.putInstance(s);
                assertEquals(1, poolService.getSize("java.lang.String"));
-               
+
                poolService.clearPool("java.lang.String");
                assertEquals(0, poolService.getSize("java.lang.String"));
        }
@@ -126,15 +112,15 @@ public class PoolServiceTest extends BaseUnit5Test
         * Class to test for void clearPool()
         */
        @Test
-       public void testClearPool() 
+       public void testClearPool()
        {
                String s = "I am a string";
                assertEquals(0, poolService.getSize("java.lang.String"));
-               
+
                poolService.putInstance(s);
-               poolService.putInstance(new Double(32));
+               poolService.putInstance(Double.valueOf(32));
                assertEquals(1, poolService.getSize("java.lang.String"));
-               
+
                poolService.clearPool();
                assertEquals(0, poolService.getSize("java.lang.String"));
                assertEquals(0, poolService.getSize("java.lang.Double"));

Reply via email to