Update ThreadFactoryBuilderTest

pull/1341/head
时间邮递员 2 years ago committed by GitHub
parent 193f54f75d
commit bc19eda632
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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());
}

Loading…
Cancel
Save