diff --git a/trpc-core/src/test/java/com/tencent/trpc/core/worker/support/thread/ThreadPoolConfigTest.java b/trpc-core/src/test/java/com/tencent/trpc/core/worker/support/thread/ThreadPoolConfigTest.java index 3ae7330efc..003329bcb0 100644 --- a/trpc-core/src/test/java/com/tencent/trpc/core/worker/support/thread/ThreadPoolConfigTest.java +++ b/trpc-core/src/test/java/com/tencent/trpc/core/worker/support/thread/ThreadPoolConfigTest.java @@ -19,6 +19,8 @@ import com.tencent.trpc.core.worker.WorkerPoolManager; import java.util.HashMap; import java.util.Map; + +import org.junit.Assert; import org.junit.Test; public class ThreadPoolConfigTest { @@ -36,6 +38,7 @@ public void test() { config.setNamePrefix("namePrefix"); config.setUseFiber(Boolean.TRUE); config.setShareSchedule(Boolean.TRUE); + config.setUseVirtualThread(Boolean.FALSE); assertFalse(config.isAllowCoreThreadTimeOut()); assertEquals(50, config.getCloseTimeout()); assertEquals(40, config.getCorePoolSize()); @@ -82,4 +85,19 @@ public void testParse() { assertTrue(config.useFiber()); assertTrue(config.isShareSchedule()); } + + @Test + public void testValidate() { + ThreadPoolConfig config = new ThreadPoolConfig(); + config.setCorePoolSize(-1); + Assert.assertThrows(IllegalArgumentException.class, config::validate); + config.setCorePoolSize(0); + config.setQueueSize(-1); + Assert.assertThrows(IllegalArgumentException.class, config::validate); + config.setQueueSize(0); + config.setCloseTimeout(-1); + Assert.assertThrows(IllegalArgumentException.class, config::validate); + config.setCloseTimeout(0); + config.validate(); + } }