From bc19eda6321407f0222c7cbaab28975a7f59510c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=B6=E9=97=B4=E9=82=AE=E9=80=92=E5=91=98?= <78356082+barret-yzh@users.noreply.github.com> Date: Fri, 26 May 2023 10:45:05 +0800 Subject: [PATCH] Update ThreadFactoryBuilderTest --- .../hippo4j/common/executor/ThreadFactoryBuilderTest | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/infra/common/src/test/java/cn/hippo4j/common/executor/ThreadFactoryBuilderTest b/infra/common/src/test/java/cn/hippo4j/common/executor/ThreadFactoryBuilderTest index 45cc75e8..c0f16d9e 100644 --- a/infra/common/src/test/java/cn/hippo4j/common/executor/ThreadFactoryBuilderTest +++ b/infra/common/src/test/java/cn/hippo4j/common/executor/ThreadFactoryBuilderTest @@ -1,3 +1,4 @@ +package cn.hippo4j.common.design.builder; /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -14,13 +15,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -package cn.hippo4j.common.design.builder; - import cn.hippo4j.common.design.builder.ThreadFactoryBuilder; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; - import java.util.concurrent.ThreadFactory; import java.lang.Thread.UncaughtExceptionHandler; @@ -30,6 +28,7 @@ public class ThreadFactoryBuilderTest { TestUncaughtExceptionHandler uncaughtExceptionHandler; Thread thread; + @Before public void buildThread() { builder = ThreadFactoryBuilder.builder(); uncaughtExceptionHandler = new TestUncaughtExceptionHandler(); @@ -46,26 +45,22 @@ public class ThreadFactoryBuilderTest { @Test public void testName() { - buildThread(); Assert.assertEquals("my-thread-factory_0", thread.getName()); } @Test public void testIsDaemon() { - buildThread(); Assert.assertTrue(thread.isDaemon()); } @Test public void testExceptionHandler() { - buildThread(); Assert.assertEquals(uncaughtExceptionHandler, thread.getUncaughtExceptionHandler()); } @Test public void testPriority() { - buildThread(); Assert.assertEquals(Thread.MAX_PRIORITY, thread.getPriority()); }