### Question:
PrefixedThreadFactory implements ThreadFactory { @Override public Thread newThread(Runnable r) { String name = prefix + nextSuffix.getAndIncrement(); return new Thread(r, name); } PrefixedThreadFactory(String prefix); @Override Thread newThread(Runnable r);  }### Answer:
@Test public void creates_threads_whose_names_are_the_prefix_and_a_running_number() { PrefixedThreadFactory threadFactory = new PrefixedThreadFactory("prefix-"); Thread thread1 = threadFactory.newThread(new DummyRunnable()); Thread thread2 = threadFactory.newThread(new DummyRunnable()); assertThat(thread1.getName()).isEqualTo("prefix-1"); assertThat(thread2.getName()).isEqualTo("prefix-2"); }