ThreadFactoryBuilder { public ThreadFactoryBuilder withWrappedThreadFactory(@Nullable ThreadFactory wrappedThreadFactory) { this.wrappedThreadFactory = wrappedThreadFactory; return this; } private  ThreadFactoryBuilder(); static ThreadFactoryBuilder create(); ThreadFactoryBuilder withWrappedThreadFactory(@Nullable ThreadFactory wrappedThreadFactory); ThreadFactoryBuilder withName(@Nullable String name); ThreadFactoryBuilder withNamePrefix(@Nullable String namePrefix); ThreadFactoryBuilder withDaemonThreads(boolean daemonThreads); ThreadFactoryBuilder withUncaughtExceptionHandler(
            @Nullable UncaughtExceptionHandler uncaughtExceptionHandler); ThreadFactoryBuilder withPriority(@Nullable Integer priority); ThreadFactory build();  }
@Test public void testWithWrappedThreadFactory() { String testThreadName = "i-am-test"; ThreadFactory wrappedThreadFactory = new ThreadFactory() { @Override public Thread newThread(Runnable r) { Thread result = new Thread(r); result.setName(testThreadName); return result; } }; ThreadFactory threadFactory = ThreadFactoryBuilder.create().withWrappedThreadFactory(wrappedThreadFactory) .build(); Thread testThread = threadFactory.newThread(TEST_RUNNABLE); assertThat(testThread.getName(), is("OH-" + testThreadName)); }