### Question:
ThreadFactories { public static ThreadFactory deamons() { return ThreadFactories.deamons(DEFAULT_THREAD_NAME); } private  ThreadFactories(); static ThreadFactory deamons(); static ThreadFactory deamons(final String threadName);  }### Answer:
@Test public void testDefaultDeamonThreadFactory() throws Exception { final ThreadFactory deamons = ThreadFactories.deamons(); assertThat(deamons, sameInstance(ThreadFactories.deamons())); assertThat(deamons.newThread(mock(Runnable.class)).getName(), equalTo("Thread-1-Daemon")); assertThat(deamons.newThread(mock(Runnable.class)).getName(), equalTo("Thread-2-Daemon")); assertThat(deamons.newThread(mock(Runnable.class)).getName(), equalTo("Thread-3-Daemon")); testDeamonThreadFactory(deamons); }
@Test public void testNamedDeamonThreadFactory() throws Exception { final ThreadFactory deamons = ThreadFactories.deamons("Test"); assertThat(deamons, sameInstance(ThreadFactories.deamons("Test"))); assertThat(deamons.newThread(mock(Runnable.class)).getName(), equalTo("Test-1-Daemon")); assertThat(deamons.newThread(mock(Runnable.class)).getName(), equalTo("Test-2-Daemon")); assertThat(deamons.newThread(mock(Runnable.class)).getName(), equalTo("Test-3-Daemon")); testDeamonThreadFactory(deamons); }